开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜