A date/time mask serves one of two purposes, depending on the context
in which it is used:
It determines the format of the output of various functions. For example,
in the timetostring function, the date/time mask indicates the format
to use for the string output. If the date/time mask is "hh:tt:ss"
and the time value is equivalent to 24 seconds past 9:12 a.m., the string
output is 09:12:24.
It guides the conversion from a string representation of a value to
the internal form of that value. For example, in the stringtotime function,
the date/time mask indicates the format of the input string so that
it will be correctly converted to a time value. If the input string
is "05/06/1995", the date/time mask "mm/dd/yyyy"
indicates that the substring "05" represents the month, rather
than the day.
A date/time mask is a string expression containing any valid combination
of components and, optionally, separators.
Because the date/time mask is a string, you must surround it with double-quotes.
Following are the components allowed in a date/time mask. Where applicable,
the valid range of each component is listed.
Component
Meaning
dd
Two-digit day of the month (1–31).
ddd
Three-digit day of the year (1–366).
mm
One- or two-digit month (1–12).
mon
Three-letter abbreviation of the month (Jan–Dec).
month
Full name of the month (January–December).
yy
Two-digit year (00–99).
CAUTION
We strongly recommend using the four-digit component
(yyyy) rather than the two-digit component. With the two-digit component,
internally the first two digits are assumed to be "20,"
which might not be your intention. In addition, using the four-digit
component clearly identifies the century and eliminates any ambiguity
problems.
yyyy
Four-digit year (0000–9999).
w
One-digit day of the week (0–6, 0 = Sunday, 6 = Saturday).
day
Three-letter abbreviation of the day (Sat–Sun).
dayname
Full name of the day (Sunday–Saturday).
hh
Hour of day (0–23).
tt
Minute of hour (0–59).
ss
Second of minute (0–59).
am
Indicates the time as am or pm (as opposed to a 24-hour clock).
Separators
The following symbols are valid separators. Using separators is optional.
,
.
/
-
<
>
?
:
|
^
;
"
[
]
{
}
_
=
@
%
+
(
)
*
&
#
<space>
Samples
In all the examples, the time is equivalent to:
Tuesday, June 7, 2000 at 32 seconds after 2:05 p.m.