问题描述
这是UTC时间,要把它转换成9999-12-31T08:00:00+08:00格式,放入XML中谢谢!
解决方案
解决方案二:
DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss:zzzz")
解决方案三:
usingSystem;classProgram{staticvoidMain(){Console.WriteLine(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"));Console.WriteLine(DateTime.Now.ToString("o"));}}/*程序输出:2008-06-06T19:31:00+08:002008-06-06T19:31:00.6566319+08:00*/
解决方案四:
usingSystem;classProgram{staticvoidMain(){Console.WriteLine(DateTime.Now.ToString("s"));Console.WriteLine(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"));Console.WriteLine(DateTime.Now.ToString("o"));}}/*程序输出:2008-06-06T19:33:412008-06-06T19:33:41+08:002008-06-06T19:33:41.5531766+08:00*/
时间: 2024-09-22 16:56:38