The following table shows some typical user-defined date/time formats. For more information about user-defined date/time formats consult MSDN at http://msdn.microsoft.com, and search for " .net standard date and time format strings ".
Format |
Displays |
M/d/yy |
12/7/58 |
d-MMM |
7-Dec |
d-MMMM-yy |
7-December-58 |
d MMMM |
7 December |
MMMM yy |
December 58 |
hh:mm tt |
08:50 PM |
h:mm:ss t |
8:50:35 P |
H:mm |
20:50 |
H:mm:ss |
20:50:35 |
mm:ss.fff |
02:21.456 |
M/d/yyyy H:mm |
12/7/1958 20:50 |
MM/dd/yy hh:mm |
12/07/58 20:50 |
ddMMyyyy |
07121958 |
yyyy_M_d_H_mm_ss_ff |
1958_12_7_20_50_30_45 |
The following table shows some typical user-defined number formats. It shows how each format is padded with the required number of leading zeros depending on the required format. For more information about user-defined number formats consult MSDN at http://msdn.microsoft.com, and search for " .net standard numeric format strings ".
Formatting string |
5 formatted as |
-5 formatted as |
0.5 formatted as |
:0 |
"5" |
"-5" |
"1" |
:0.00 |
"5.00" |
"-5.00" |
"0.50" |
:000 |
"005" |
"-005" |
"001" |
:#,##0 |
"5" |
"-5" |
"1" |
:0% |
"500%" |
"-500%" |
"50%" |
:0.00% |
"500.00%" |
"-500.00%" |
"50.00%" |