如何把时间转换成9999-12-31T08:00:00+08:00这样的实践格式?
这是UTC时间,要把它转换成9999-12-31T08:00:00+08:00格式,放入XML中谢谢! --------------------编程问答-------------------- DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss:zzzz") --------------------编程问答--------------------
using System;--------------------编程问答--------------------
class Program
{
static void Main()
{
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"));
Console.WriteLine(DateTime.Now.ToString("o"));
}
}
/* 程序输出:
2008-06-06T19:31:00+08:00
2008-06-06T19:31:00.6566319+08:00
*/
using System;
class Program
{
static void Main()
{
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:41
2008-06-06T19:33:41+08:00
2008-06-06T19:33:41.5531766+08:00
*/
补充:.NET技术 , ASP.NET