Please enable JavaScript to view this site.

 

Navigation: Appendices > Q++Studio > Common UI Elements

The Time Formatting Control

Scroll Prev Up Next More

The Time Formatting Control is used in many options dialogs, such as the Moon and Sun Options dialog, to specify how to format the times of Sun tokens, Moon tokens, Zodiac tokens, Jewish Times tokens, Muslim Prayer Times tokens, ...

 

 

Format

The format in which to display the times obtained.

 

A few pre-formatted selections are available.

You can create your own formatting as described further down. You should generally avoid using any formatting string that contains characters that refer to Windows global variables, since these can change on each workstation.

Round to Nearest Minute

 

Use this option to round off times to the nearest minute. For example, suppose we had the 2 following times: 07:33:13 and 17:24:43. With this option turned OFF, these times would be displayed as 07:33 and 17:24. However, if this option is turned ON, then these 2 times would be displayed as 07:33 and 17:24 (note how the 17:24 was rounded up to 17:25).

Minutes

This setting lets you specify that minutes should be displayed with different attributes than the original token (hence than the hours). Usually this setting is used to display the minutes in a smaller size font than the hours.

If no time, display

There are days when no moonrise, moonset, Moon transits, Moon phase, sunrise or sunset occurs. This option allows you to specify what text to use to represent these non-times (for example --:--).

Samples

Sample output showing the effect of the format selected above on a time before noon and a time after noon.

 

The formatting of times in the above editors is done using mostly the standard Windows time formatting (and some Q++Studio specific additional settings) which can be accomplished using combinations of the following (note how the character used to format minutes is the letter 'n', and not the letter 'm' which is used elsewhere to format months):

 

h

Displays the hour without a leading zero (0-23).

hh

Displays the hour with a leading zero (00-23).

n

Displays the minute without a leading zero (0-59).

nn

Displays the minute with a leading zero (00-59).

s

Displays the second without a leading zero (0-59).

ss

Displays the second with a leading zero (00-59).

z

Displays the millisecond without a leading zero (0-999).

zzz

Displays the millisecond with a leading zero (000-999).

t

Displays the time using the format given by the ShortTimeFormat global variable.

tt

Displays the time using the format given by the LongTimeFormat global variable.

am/pm

Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.

a/p

Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.

ampm

Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the TimePMString global variable for any hour after noon.

x/x

Uses the 12-hour clock for the preceding h or hh specifier, but does not display any am/pm label. So both morning and afternoon times are displayed exactly the same, without any indication that one corresponds to a morning time and the other to an afternoon or evening time. This formatting option should only be used if it is obvious from the context that the displayed time is a morning time or not (this is the case for Muslim prayer times where, for example, the time displayed for the sunset prayer is obviously after the noon hour). If the x/x formatting option is preceded by a space (for example: h:nn x/x) then that space will be removed by Q++Studio automatically to prevent problems with extra spaces if your times are displayed aligned to the right.

/

Displays the date separator character given by the DateSeparator global variable.

:

Displays the time separator character given by the TimeSeparator global variable.

"text"

Characters enclosed in double quotes are displayed as-is, and do not affect formatting.

 

Format specifiers may be written in upper case as well as in lower case letters--both produce the same result. If the string specified by the Format parameter is empty, the value is formatted as if a 'c' format specifier had been given.

 


Topic 174790, last updated on 01-Aug-2020