3.4. Date formatting

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 Current day of the month (2 digits)
%e Numeric day of the month, no leading 0
%D MM/DD/YY
%h Month of year, abbreviated
%H Current hour (00-23)
%I Hour, 12-hour clock, leading 0
%j Day of the year
%k Hour
%l Hour, 12-hour clock
%m Current month number (2 digits, 01-12)
%M Current minute (00-59)
%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 Current second (00-59)
%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 Last 2 digits of the current year (2 digits)
%Y Current 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.