How do I parse and convert a DateTime to the RFC 3339 date-time format?

后端 未结 5 1789
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 00:22

How do I convert a DateTime structure to its equivalent RFC 3339 formatted string representation and/or parse this string representation back to a DateTime structure? The RF

5条回答
  •  温柔的废话
    2020-12-03 01:24

    In .NET (assuming UTC):

     datetime.ToString("YYYY-MM-DD'T'HH:mm:ssZ")
    

    DateTime.Parse() can be used to convert back into a DateTime structure.

提交回复
热议问题