How can I get StackOverflow style timestamps with the DateTime class?
How can I get a date that looks like this:
2010-07-08 23:59:59Z
from 开发者_如何转开发.NET's DateTime class?
You're looking for the universal sortable format string, like this:
string str = DateTime.Now.ToString("u");
See:
- Standard Date and Time Format Strings
- Custom Date and Time Format Strings
string date = DateTime.Now.ToString("u");
精彩评论