The following table identifies characters that can appear in the format string for date/time formats.
|
Character
|
Description
|
|---|
|
:
|
Represents a time separator that separates hours, minutes, and seconds when time values are formatted.
The actual character used as the time separator in formatted output is determined by the system settings of the computer.
Note:
In some locales, other characters may used as the time separator.
|
|
/
|
Represents a date separator that separates the day, month, and year when date values are formatted.
The actual character used as the date separator in formatted output is determined by the system settings of the computer.
Note:
In some locales, other characters may be used to represent the date separator
|
|
C
|
Displays the date as ddddd and displays the time as ttttt, in that order.
Displays only date information if there is no fractional part to the date serial number. Displays only time information if there is no integer portion.
|
|
d
|
Displays the day as a number without a leading zero (1–31).
|
|
dd
|
Displays the day as a number with a leading zero (01–31).
|
|
ddd
|
Displays the day as an abbreviation (Sun–Sat).
|
|
dddd
|
Displays the day as a full name (Sunday–Saturday).
|
|
ddddd
|
Displays the date as a complete date (including day, month, and year), formatted according to your system's short date format setting.
For Microsoft Windows, the default short date format is m/d/yy.
|
|
dddddd
|
Displays a date serial number as a complete date (including day, month, and year), formatted according to the long date setting recognized by the computer system.
For Windows, the default long date format is mmmm dd, yyyy.
|
|
w
|
Displays the day of the week as a number (1 for Sunday through 7 for Saturday).
|
|
ww
|
Displays the week of the year as a number (1–54).
|
|
m
|
Displays the month as a number without a leading zero (1–12).
If m immediately follows h or hh, the minute instead of the month is displayed.
|
|
mm
|
Displays the month as a number with a leading zero (01–12).
If m immediately follows h or hh, the minute instead of the month is displayed.
|
|
mmm
|
Displays the month as an abbreviation (Jan–Dec).
|
|
mmmm
|
Displays the month as a full month name (January–December).
|
|
q
|
Displays the quarter of the year as a number (1–4).
|
|
y
|
Displays the day of the year as a number (1–366).
|
|
yy
|
Displays the year as a two-digit number (00–99).
|
|
yyyy
|
Displays the year as a four-digit number (100–9999).
|
|
h
|
Displays the hour as a number without leading zeros (0–23).
|
|
hh
|
Displays the hour as a number with leading zeros (00–23).
|
|
n
|
Displays the minute as a number without leading zeros (0–59).
|
|
nn
|
Displays the minute as a number with leading zeros (00–59).
|
|
s
|
Displays the second as a number without leading zeros (0–59).
|
|
ss
|
Displays the second as a number with leading zeros (00–59).
|
|
t t t t t
|
Displays a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by the computer system.
A leading zero is displayed if the leading zero option is selected, and the time is earlier than 10:00 in either the A.M. or the P.M. cycle. For example, 09:59,
For Windows, the default time format is h:mm:ss.
|
|
AM/PM
|
Displays an uppercase AM with any hour from midnight until noon; displays an uppercase PM with any hour from noon until midnight.
Note:
Uses the 12-hour clock.
|
|
am/pm
|
Displays a lowercase am with any hour from midnight until noon; displays a lowercase pm with any hour from noon until midnight.
Note:
Uses the 12-hour clock.
|
|
A/P
|
Displays an uppercase A with any hour from midnight until noon; displays an uppercase P with any hour from noon until midnight.
Note:
Uses the 12-hour clock.
|
|
a/p
|
Displays a lowercase a with any hour from midnight until noon; displays a lowercase p with any hour from noon until midnight.
Note:
Uses the 12-hour clock.
|
|
AMPM
|
Displays the AM string literal as defined by the computer system with any hour from midnight until noon; displays the PM string literal as defined by the computer system with any hour from noon until midnight.
Note:
Uses the 12-hour clock.
AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by the system settings of the computer.
For Windows, the default format is AM/PM.
|