3.2. Date formatting Previous topic Parent topic Child topic Next topic

When Radiator is required to format a date for use with SQL and other databases it uses a configurable DateFormat. A DateFormat can include special characters which are interpreted according to the following table. Any other characters will be used verbatim.

Table 5. DateFormat special characters

Specifier Replacement
%% Percent character
%a Day of the week, abbreviated
%A Day of the week
%b Month, of the year, abbreviated
%B Month of the year
%c Ctime format, for example, Sat Nov 19 21:05:57 1994
%d Numeric day of the month DD, with a leading 0 if necessary
%e Numeric day of the month, no leading 0
%D MM/DD/YY
%h Month of year, abbreviated
%H Hour, 24-hour clock, leading 0
%I Hour, 12-hour clock, leading 0
%j Day of the year
%k Hour
%l Hour, 12-hour clock
%m Month number, starting with Jan = 1
%M Minute, leading 0
%n NEWLINE character
%o Ornate day of month, for example, 1st, 2nd, 25th
%p AM or PM
%r Time format: 09:05:57 PM
%R Time format: 21:05
%S Seconds, leading 0
%t TAB character
%T Time format: 21:05:57
%U Week number, Sunday as first day of week
%w Day of the week, numerically, Sunday = 0
%W Week number, Monday as first day of week
%x Date format: 11/19/94
%X Time format: 21:05:57
%y Year (2 digits)
%Y Year (4 digits)
%Z Timezone in ASCII. eg: PST
For example, DateFormat %b %e, %Y %H:%M would format a date and time like: Sep 3, 1995 13:37.