These codes are used to insert a specific date and/or time into the target document.
Code | Action | Example |
<YYYY> | Insert the current year with century, as decimal number | If today is April 10, 2001 then <YYYY> with insert "2001" |
<YY> | Insert the current year without century, as decimal number (00-99) | If today is April 09, 2001 then <YY> with insert "01" |
<MMMM> | Insert the current month name in full form | If today is April 09, 2001 then <MMMM> with insert "April" |
<MMM> | Insert the current month name in short form | If today is April 09, 2001 then <MMM> with insert "Apr" |
<MM> | Insert the current month as decimal number (01-12) | If today is April 09, 2001 then <MM> with insert "04" |
<M> | Insert the current month as decimal number without the leading zero (1-12) | If today is April 09, 2001 then <M> with insert "4" |
<DDDD> | Insert the current weekday name in full form | If today is April 09, 2001 then <DDDD> with insert "Tuesday" |
<DDD> | Insert the current weekday name in short form | If today is April 09, 2001 then <DDD> with insert "Tue" |
<DD> | Insert the current day of month as decimal number (01-31) | If today is April 09, 2001 then <DD> with insert "09" |
<D> | Insert the current day of month as decimal number without the leading zero (1-31) | If today is April 09, 2001 then <DD> with insert "9" |
<HOUR12> | Insert the current hour of day in 12-hour format (00-11) | If now is 13:15:16 PM then <HOUR12> with insert "01" |
<HOUR> | Insert the current hour of day in 24-hour format (00-23) | If now is 13:15:16 PM then <HOUR> with insert "13" |
<MIN> | Insert the current minute of hour in decimal number (00-59) | If now is 13:15:16 PM then <MIN> with insert "15" |
<SEC> | Insert the current second of minute in decimal number (00-59) | If now is 13:15:16 PM then <SEC> with insert "16" |
<AMPM> | Insert the AM/PM indicator | If now is 13:15:16 PM then <AMPM> with insert "PM" |
These extended codes are also used to insert a specific date and/or time into the target document.
Code | Action | Example |
<TIME:format> | Insert the current time with the specific format (see below) | If today is April 10, 2001 then <TIME:%#m/%#d/%y> with insert 04/10/01 |
<TIME:+(hours:minutes :seconds):format> | Insert the time ahead of the current time by (hours:minutes :seconds), and with the specific time format (see below) | <TIME:+(24:0:0):%#d> will insert the date of 24 hours from now (e.g tomorrow) |
<TIME:-(hours :minutes :seconds):format> | Insert the time before the current time by (hours:minutes :seconds), and with the specific time format (see below) | <TIME:-(24:0:0):%#d> will insert the date of 24 hours prior (e.g. yesterday) |
Time Format
The time format consists of one or more characters. Characters preceded by a percent sign % bear a special meaning:
Characters | Meaning | Example |
%a | Abbreviated weekday name | |
%A | Full weekday name | |
%b | Abbreviated month name | |
%B | Full month name | |
%c | Date and time representation appropriate for the current Windows setting | |
%d | Day of month as decimal number (01 - 31) | |
%H | Hour in 24-hour format (00 - 23) | |
%l | Hour in 12-hour format (01 - 12) | |
%j | Day of year as decimal number (001 - 366) | |
%m | Month as decimal number (01 - 12) | |
%M | Minute as decimal number (00 - 59) | |
%p | A.M./P.M. indicator for 12-hour clock | |
%S | Second as decimal number (00 - 59) | |
%U | Week of year as decimal number, with Sunday as the first day of week (00 - 53) | |
%w | Weekday as decimal number (0 - 6; Sunday is 0) | |
%W | Week of year as decimal number, with Monday as the first day of week (00 - 53) | |
%y | Year without century, as decimal number (00 - 99) | |
%Y | Year with century, as decimal number | |
%% | Percent sign (%) |
Characters that do not begin with & are left unchanged. You can also use the # flag to prefix any formatting code. In that case, the meaning of the format code is changed as follows.
%#a, %#A, %#b,
%#B, %#p, %#X, %#z,
%#Z, %#%
# flag is ignored.
%#c
Long date and time representation. For example: "Tuesday,
March 14, 1995, 12:41:29".
%#x
Long date representation. For example: "Tuesday, March 14,
1995".
%#d, %#H, %#I,
%#j, %#m, %#M, %#S,
%#U, %#w, %#W, %#y,
%#Y
Remove leading zeros (if any).