Time Formatting

Navigation:  Appendices > Windows Refresher >

Time Formatting

Previous pageReturn to chapter overviewNext page

There are many tokens that are used to display a time (Sun, Moon, Jewish Times, Muslim Prayer Times). For these tokens, each Script has options that let you specify how these times should be displayed.

 

 

The formatting of times in the above editors is done using mostly the standard Windows time formatting (and some Q++ 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++ 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 updated on 27-Sep-2016.
Topic URL: http://www.qppstudio.net/webhelp/index.html?timeformatting.htm