DateTime Format
-
How can I get DateTime.now in this format: "Wed, 05 Apr 2006 21:12:00 GMT" ?
/\ |_ E X E GG
-
You use the .ToString() method of your variable, and you pass it a DateTimeFormatInfo argument, described here: http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo(VS.71).aspx[^]
For instance, you can use: string const MY_LONG_FORMAT = "MM/dd/yy HH:mm:ss:ffff" string output = DateTime.Now(MY_LONG_FORMAT); Note that the above format is NOT the one you want; you'll need to look at the link I provided in the earlier post to see how to build your format string.
modified on Friday, December 28, 2007 3:48:36 AM
-
For instance, you can use: string const MY_LONG_FORMAT = "MM/dd/yy HH:mm:ss:ffff" string output = DateTime.Now(MY_LONG_FORMAT); Note that the above format is NOT the one you want; you'll need to look at the link I provided in the earlier post to see how to build your format string.
modified on Friday, December 28, 2007 3:48:36 AM
-
How can I get DateTime.now in this format: "Wed, 05 Apr 2006 21:12:00 GMT" ?
/\ |_ E X E GG
Please only use ISO 8601 compliant formats.
-
Please only use ISO 8601 compliant formats.