简体   繁体   中英

what is the C# equalivent to gmdate(DATE_ISO8601)

how can i create time in this format (DATE_ISO8601) in C# ? 2009-05-18T16:34:09.423-0700

thank you!

You can use the O or o format specifier.

DateTime.Now.ToString("O");

From MSDN (Standard Date and Time Format Strings):

The pattern for this specifier reflects a defined standard (ISO 8601). Therefore, it is always the same regardless of the culture used or the format provider supplied. Strings that are passed to the Parse or ParseExact method must conform exactly to this custom format pattern, or a FormatException is thrown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM