A date/time mask is a string expression containing any valid combination of components and, optionally, separators. For example, in the date/time mask "yy/mm/dd", the separator character is a "/", and the components are "yy", "mm", and "dd". You can specify components in any order. For usage examples, see date/time mask samples.
The following components are valid date/time mask components.
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). Note: Use the four-digit component
(yyyy) rather than the two-digit component to clearly identify the
century and eliminate any ambiguity problems. With the two-digit component,
internally the first two digits are assumed to be 20, which might
not be your intention.
|
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). |
xs:datetime | Indicates the date and time in XML format as described by
W3C XML Schema and ISO 8601. The format is:
All
fields must be present and can optionally be preceded by a sign and
leading figures, if needed, and followed by fractional digits for
the seconds and a time zone. The time zone can be specified by using
the letter Z, which identifies UTC, or by the difference of time with UTC. |
The following symbols are valid separators. Separators is optional.
Separator symbol | Separator symbol | Separator symbol |
---|---|---|
, | . | / |
- | < | > |
? | : | | |
^ | ; | |
[ | ] | { |
} | _ | = |
@ | % | + |
( | ) | * |
& | # | <space> |
In all the examples, the time is equivalent to:
Wednesday, June 8, 2000 at 2 seconds after 2:05 p.m.
Mask | Results |
---|---|
mon. dd, yyyy | Jun. 8, 2000 |
month dd, yyyy | June 8, 2000 |
mon dd, yy (day) | Jun 8, 00 (Wed) |
''hhttss | 140532 |
hh:tt am | 02:05 pm |
dd-mm-yy, hh:tt | 8-6-00, 14:05 |
mm/dd/yyyy, hh:tt:ss am | 6/8/2000, 02:05:032 pm |
ddd, hh:tt:ss | 167, 14:05:32 |
tt:ss am | 05:32 pm |
xs:datetime | 2000-06-08T14:05:32 |