03.01.2015 Views

C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

804 ❘ Appendix P Date and Time Format Specifiers<br />

(continued)<br />

Specifier Meaning Example<br />

G General date/time with long time. 8/20/2015 2:37:18 PM<br />

m or M Month and date. August 20<br />

r or R<br />

RFC1123 pattern. Formatting does not<br />

convert the time to Greenwich Mean<br />

Time (GMT), so you should convert<br />

local times to GMT before formatting.<br />

Thu, 20 Aug 2015 14:37:18 GMT<br />

S Sortable ISO 8601 date/time. 2015-08-20T14:37:18<br />

u<br />

U<br />

Universal sortable date/time. Formatting<br />

does not convert the time to universal<br />

time, so you should convert local times<br />

to universal time before formatting.<br />

Universal full date/time. This is the full<br />

universal time, not the local time.<br />

2015-08-20 14:37:18Z<br />

Thursday, August 20, 2015 9:37:18 PM<br />

y or Y Year and month. August 2015<br />

Custom Format Specifiers<br />

Custom format specifiers describe pieces of a date or time that you can use to build your own customized<br />

formats. For example, the specifier ddd indicates the abbreviated day of the week, as in Wed.<br />

In general, you should use custom date and time formats only to build values used inside the code.<br />

The user should never see them.<br />

The following table lists characters that you can use to build custom formats for date and time strings.<br />

Specifier Meaning Example<br />

d Date of the month (1–31). 3<br />

dd Date of the month with two digits (01–31). 03<br />

ddd Abbreviated day of the week. Wed<br />

dddd Full day of the week. Wednesday<br />

f<br />

Fractions of seconds, one digit. Add additional fs for up to<br />

seven digits (fffffff).<br />

8<br />

F Similar to f except nothing is displayed if the fraction is 0. 8<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!