Sunday, May 26, 2013

c# date format strings

I always find it hard to find the date time format strings. I thought I would dump them here. I got the information from this msdn page .

d - day of the month with no leading zero
dd - day of the month with leading zero
ddd - Abbreviated day of the week
dddd - day of the week in full 
f / ff / fff / ffff / fffff / ffffff / fffffff - fractions of a second. Prints the number of digits including trailing zeros
F / FF / FFF / FFFF / FFFFF / FFFFFF / FFFFFFF - fractions of a second. does not print trailing zeros

h  - prints 12 hour time without leading zero
hh, hh  prints hour in 12 hour time with leading zero.
H - prints hour in 24 hours time without leading zeros.
HH, HH - prints hour in 24 hour time with leading zero.
m/mm - minute without/with leaing zero 
M/MM - numeric month without/with leading zero
MMM - abbreviated month name
MMMM - month full name.
s/ss - seconds without/with leading zeros.
yyyy - year

No comments: