Custom Date Format String
The custom date command requires a format string. This consists of one or more codes; the formatting codes are preceded by a percent sign (%).
Characters that do not begin with % are used unchanged. The formatting codes are listed below.
Standard Formatting Codes
%a |
Abbreviated day of the week. |
%A |
Day of the week. |
%b |
Abbreviated month. |
%B |
Month. |
%d |
Day of the month as digits with leading zeros for single-digit days (01 - 31). |
%m |
Month as digits with leading zeros for single-digit months (01 - 12). |
%y |
Year represented only by the last two digits. A leading zero is added for single-digit years (00 - 99). |
%Y |
Year with century. |
Less Frequent Formatting Codes
%j |
Day of year as decimal number (001 - 366). |
%U |
Week of year as decimal number, with Sunday as 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 first day of week (00 - 53). |
%% |
Percent sign. |
Time Formatting Codes
The only database fields that have valid time values are those in the Journal table.
%H |
Hour in 24-hour format (00 – 23). |
%I |
Hour in 12-hour format (01 – 12). |
%M |
Minute as decimal number (00 – 59). |
%p |
AM / PM time indicator (this is determined by your operating system regional settings). |
Addendum
The # flag may prefix any formatting code. In that case, the meaning of the format code is changed as follows.
%#a, %#A, %#b, %#B, %#p, %#% |
# flag is ignored. |
%#d, %#H, %#I, %#j, %#m, %#M, %#U, %#w, %#W, %#y, %#Y |
Remove leading zeros (if any). |
Examples
Assuming that today is 20/05/19 (UK format)
CUSTOMDATE "%B %#d, %Y" would generate "May 20, 2019"
CUSTOMDATE "%A, %d %b, %Y" would generate "Monday, 20 May, 2019"
CUSTOMDATE_FIELD "Last Given" "%B %y" would generate "May 19"
CUSTOMDATE_FIELD "JournalDateEdit" "%d %b %y %#I:%M %p" would generate 20 May 19 4:23 PM
CUSTOMDATE_FIELD "JournalDateEdit" "%d %b %y %H:%I" would generate 20 Jun 19 16:23