CodeCharge Studio

Date Formats Comparison

CCS Access (VBA) Java ColdFusion .NET PHP Description
GeneralDate c G General date predefined format
ShortDate ddddd d Short Date predefined format.
LongDate dddddd D Long Date predefined format.
ShortTime t Short Time predefined format.
LongTime ttttt T Long Time predefined format.
f Full date and time predefined format (long date and short time)
F Full date and time predefined format (long date and long time)
g General date predefined format (short date and short time)
B Swatch Internet time
r, R r RFC 1123(822) formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200"
m, M Month and Day predefined format
s Sortable Date and Time predefined format (ISO 8601) using local time
u Universal Sortable Date and Time predefined format (ISO 8601) using universal time
U Sortable date and time (long date and long time) using universal time
y, Y Year and month predefined format (yyyy MMMM)
Days
d d d d d j Day of the month in one or two numeric digits, as needed (1 to 31).
dd dd dd dd dd d Day of the month in two numeric digits (01 to 31).
ddd ddd EE ddd ddd D First three letters of the weekday (Sun to Sat).
dddd dddd EEEE dddd dddd Full name of the weekday (Sunday to Saturday).
w w w Day of the week.
l (lowercase "L") Full name of the weekday (Sunday to Saturday).
y D z Day of the year (0 to 365)
Months
m m M m M n Month of the year in one or two numeric digits, as needed (1 to 12).
mm mm MM mm MM m Two numeric digits (01 to 12) of Month of the Year.
mmm mmm mmm MMM M First three letters of the month (Jan to Dec).
mmmm mmmm MMM mmmm MMMM F Full name of the month (January to December).
Years
yy yy yy yy yy y Last two digits of the year (01 to 99).
yyyy yyyy yyyy yyyy yyyy Y Full year (0100 to 9999).
y The two last digits of the year without the leading zero (1 to 99).
Hours
H h H H H G Hour in one or two digits, as needed (0 to 23).
HH hh HH HH HH H Hour in two digits (00 to 23).
h K h h g Hour in one or two digits, as needed (0 to 11).
hh KK hh hh h Hour in two digits (00 to 11).
Minutes
n n m m m Minute in one or two digits, as needed (0 to 59).
nn nn mm mm mm i Minute in two digits (00 to 59).
Seconds
s s s s s Second in one or two digits, as needed (0 to 59).
ss ss ss ss ss s Second in two digits (00 to 59).
Milliseconds
S Milisecond in one or two digits, as needed (0 to 99).
SS Milisecond in two digits (00 to 99).
Other
AM/PM AM/PM h/k + a tt tt A Twelve-hour clock with the uppercase letters "AM" or "PM", as appropriate.
am/pm am/pm a Twelve-hour clock with the lowercase letters "am" or "pm", as appropriate.
A/P A/P t t Twelve-hour clock with the uppercase letter "A" or "P", as appropriate.
a/p a/p Twelve-hour clock with the lowercase letter "a" or "p", as appropriate.
AMPM Twelve-hour clock with the appropriate morning/afternoon designator based on current regional settings.
z The time zone offset (hour only). Single-digit hours will not have a leading zero.
zz The time zone offset (hour only). Single-digit hours will have a leading zero.
zzz The full time zone offset (hour and minutes). Single-digit hours and minutes will have leading zeros.
L boolean for whether it is a leap year; i.e. "0" or "1"
t number of days in the given month; i.e. "28" to "31"
z T Timezone setting of this machine; i.e. "MDT"
U seconds since the epoch
Z timezone offset in seconds (i.e. "-43200" to "43200"). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
I (capital i) 1 if Daylight Savings Time, "0" otherwise.
S English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
" ' Escape for text (Delimiter), e.g. 'on' MMM dd means "on July 25"
zzzz Time zone, full form e.g. "Pacific Standard Time"
W Week in month (1-4)
F Day of week in month e.g. 2 (2nd Wed in July)
G gg gg Era designator e.g. AD
: : : Time separator (taken from the Regional settings)
/ / / Date separator (taken from the Regional settings)
ww ww w Week of the year (1 to 53). The first week considered the week which has January 1.
Note: This parameter is not supported in .NET.
q q Date displayed as the quarter of the year (1 to 4). This format is supported only in ASP, PHP and Perl.
\c \c Where c is any character. Displays the character literally.
CCS Access (VBA) Java ColdFusion .NET PHP Description

See Also

Date Format, Date format using concept


On-line, printable versions and updates