Given a DateTime object, how do I get an ISO 8601 date in string format?

后端 未结 18 2217
暖寄归人
暖寄归人 2020-11-22 02:15

Given:

DateTime.UtcNow

How do I get a string which represents the same value in an ISO 8601-compliant format?

Note that ISO 8601 de

18条回答
  •  情歌与酒
    2020-11-22 02:19

    System.DateTime.UtcNow.ToString("o")
    

    =>

    val it : string = "2013-10-13T13:03:50.2950037Z"
    

提交回复
热议问题