You can format a datetime object to the desired format using the ToString
method and a custom format string. Here's an example in C#:
main.cs225 chars5 lines
In the format string, MMMM
represents the full month name (October
), dd
represents the zero-padded day of the month (13
), yyyy
represents the four-digit year (2014
), h
represents the 12-hour clock hour (11
), mm
represents the zero-padded minute (13
), ss
represents the zero-padded second (00
), fff
represents the milliseconds (000
), tt
represents the AM/PM designator (AM
), "GMT"
represents a literal string GMT
, and zzz
represents the timezone offset (-07:00
).
gistlibby LogSnag