To use a user-defined format for creating calendar dictionary element names, in the expression editor enter the line:
@[<user-defined format>]
where in brackets you specify the user-defined format.
The following table presents characters used to create user-defined date and time formats.
Character | Brief description |
: | Time delimiter. Time delimiter separates hours, minutes, and seconds when formatting time values. The actual symbol used as a time delimiter in output is defined by the LocaleID system value. |
/ | Date delimiter. Date delimiter separates day, month, and year on formatting date values. The actual symbol used as a date delimiter in output is defined by locale settings. |
% | It denotes that the next character must be read as a single-letter format without considering closing letters. It is also used to denote that a single-letter format is read as a user-defined format. For details see below. |
d | It displays the day as a number without a preceding zero (for example, 1). Use %d if it is the only character in the user-defined numeric format. |
dd | It displays the day as a number with a preceding zero (for example, 01). |
ddd | It displays the name of the day as an abbreviation (for example, Tu). |
dddd | It displays the name of the day in full (for example, Tuesday). |
M | It displays the month as a number without a preceding zero (for example, 1). Use %M if it is the only character in the user-defined numeric format. |
MM | It displays the month as a number with a preceding zero (for example, 08). |
MMM | It displays the name of the month as an abbreviation (for example, Jan). |
MMMM | It displays the name of the month in full (for example, January). |
gg | It displays the era (for example, A.D.). |
h | It displays hours as a number without the preceding zero using the 12-hour format (for example, 1:15:15 PM). Use %h if it is the only character in the user-defined numeric format. |
hh | It displays hours as a number with the preceding zero using the 12-hour format (for example, 01:15:15 PM). |
H | It displays hours as a number without the preceding zero using the 24-hour format (for example, 1:15:15). Use %H if it is the only character in the user-defined numeric format. |
HH | It displays hours as a number with the preceding zero using the 24-hour format (for example, 1:15:15). |
m | It displays minutes as a number without the preceding zero (for example, 12:1:15). Use %m if it is the only character in the user-defined numeric format. |
mm | It displays minutes as a number with the preceding zero (for example, 12:01:15). |
s | It displays seconds as a number without the preceding zero (for example, 12:15:5). Use %s if it is the only character in the user-defined numeric format. |
ss | It displays seconds as a number with the preceding zero (for example, 12:15:05). |
F | It displays fractional parts of a second. For example, ff displays the hundredth parts of a second, while ffff displays no less than the ten thousandth. In the user-defined format, it is possible to use up to seven f symbols. Use %f if it is the only character in the user-defined numeric format. |
T | It uses the 12-hour format and displays AM in the upper case for any hour before midday. Displays PM in the upper case for any hour after midday and until 11:59 P.M.; use %t if it is the only character in the user-defined numeric format. |
tt | It uses the 12-hour format and displays AM in the upper case for any hour before midday. Displays PM in the upper case for any hour after midday and until 11:59 P.M. |
y | It displays the year (0-9) without preceding zeros. Use %Y if it is the only character in the user-defined numeric format. |
yy | It isplays the year as two numbers with a preceding zero, if necessary. |
yyy | It displays the year as four numbers. |
yyyy | It displays the year as four numbers. |
z | It displays the time shift between time zones without the preceding zero (for example, -8). Use %z if it is the only character in the user-defined numeric format. |
zz | It displays the time shift between time zones with a preceding zero (for example, -08). |
zzz | It displays the time shift between time zones in full format (for example, -08:00). |
The table presents various examples of user-defined formats for December 7, 1958 at 35 seconds after 8:50 PM local time:
Specified format | Result |
M/d/yy | 12/7/58 |
d-MMM | 7-dec |
d-MMMM-yy | 7-december-58 |
d MMMM | 7 December |
MMMM yy | December 58 |
hh:mm tt | 08:50 PM |
h:mm:ss t | 8:50:35 P |
H:mm | 20:50 |
H:mm:ss | 20:50:35 |
M/d/yyyy H:mm | 12/7/1958 20:50 |
See also: