how can i create time in this format (DATE_ISO8601) in C# ?开发者_StackOverflow中文版 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.
精彩评论