%d | Displays the current day of the month, measured as a number between 1 and 31, inclusive. Single digit only (1-9) displayed as a single digit. | 2 |
dd | Displays the current day of the month, measured as a number between 1 and 31, inclusive. Single digit only (1-9) is prefixed with a preceding 0 (01-09). | 02 |
ddd | Displays the abbreviated name of the day specified. | Thu |
dddd(plus any number of additional "d" characters | Displays the full name of the day specified. | Thursday |
f to fffffff | Displays seconds fractions represented in one to seven digits. | 1 to 1500000 |
g or gg or any number of additional "g" characters | Displays the era (A.D., for example). | A.D. |
%h | Displays the hour for the specified value in 12- hour format (undistinguished AM/PM, range 1-12). No rounding occurs; that is, a value of 4:45 returns 4. | 11 |
hh plus any number of additional "h" characters | Same as above, but a single digit hour (1-9) is preceded with 0 (01-09). | 11 |
%H | Displays the hour for the specified value in 24-hour format (the range 0-23). The hour represents whole hours passed since midnight (displayed as 0). If the hour is a single digit (0-9), it is displayed as a single digit. | 23 |
HH, HH (plus any number of additional "H" characters)%m | Same as above, but a single digit hour(1-9) is preceded with 0 (01-09). | 23 |
%m | Displays the minute for the specified value in the range 0-59. The minute represents whole minutes passed since the last hour. If the minute is a single digit (0-9), it is displayed as a single digit. | 59 |
mm, mm (plus any number of dditional "m" characters) | Same as above. A single digit minute (0-9) is formatted with a preceding 0 (01-09). | 59 |
%M | Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is displayed as a single digit. | 1 |
MM | Same as above. A single digit month (1-9) is formatted with a preceding 0 (01-09). | 01 |
MMM | Displays the abbreviated name of the month for the specified value. | Jan |
MMMM | Displays the full name of the month for the specified value. | January |
%s | Displays the seconds for the specified value in the range 0-59. The second represents whole seconds passed since the last minute. If the second is a single digit (0-9), it is displayed as a single digit only. | 11 |
ss, ss (plus any number of additional "s" characters) | Same as above. A single digit second (0-9) is formatted with a preceding 0 (01-09). | 11 |
%t | Displays the first character of the A.M./P.M. designator for the specified value. | P |
tt, tt (plus any number of additional "t" characters) | Displays the A.M./P.M. designator for the specified value. | PM |
%y | Displays the year for the specified value as a maximum two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is displayed as a single digit. | 3 |
yy | Same as above. A single digit year (1-9) is formatted with a preceding 0 (01-09). | 03 |
yyyy | Displays the year for the specified value, including the century. If the year is less than four digits, 0s are added to the left to display four digits. | 2003 |
%z | Displays the time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading sign, which indicates hours ahead of Greenwich mean time (+) or behind Greenwich mean time (-). The range of values is -12 to +13. Value is affected by daylight savings time. | -6 Note:-6 offset is for central standard time. |
zz | Same as above. Single digit is formatted with a preceding 0 (00-09). | -06 |
zzz, zzz (plus any number of additional "z" characters) | Same as above, but displays hours and minutes. The range of values is -12:00 to +13:00. Single digit offset (0-9) is formatted with a preceding 0 (00-09). | -06:00 |
: | Displays time separator. | |
/ | Displays date separator. | |
"or' | Displays the literal value of a string enclosed . | |
\ | Displays the next character as a literal. Cannot be used to create an escape sequence. | |