问题描述
我正在尝试重现一个特定文件,其日期存储如下:
2015-10-06T01:13:46.2784945 + 01:00
我可以将它解析为日期,但我现在需要把它放回去。 />
我在英国,所以我猜这个+01:00是BST?
有没有一种简单的方法从DateTime输出?
谢谢^ _ ^
Andy
Hi,
I'm trying to reproduce a particular file that has the date stored as follows:2015-10-06T01:13:46.2784945+01:00
I can parse it as a date fine, but I now need to put it back.
I'm in the UK so I'm guessing that the +01:00 is BST?
Is there a simple way to output this from a DateTime?
Thanks ^_^
Andy
推荐答案
[date]T[utc-time][timezone]
[utc-time]和[timezone]很简单,唯一的问题是[date]部分的日/月顺序...这可以通过查看一些样本数据来决定......
你有两个选择:
[utc-time] and [timezone] are simple, the only question is the day/month order in the [date] part...That's can be decided by looking on some sample data...
The two options you have are these:
YYYY-MM-DDTHH:MM:SS[+/-]HH:MM
YYYY-DD-MMTHH:MM:SS[+/-]HH:MM
请注意,SS也有小数点后的数字...
Notice, that SS has digits after the decimal point too...
Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK")
或只是
or just
Now.ToString("o")
请参阅 []
这篇关于QQ:你认识这个日期格式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!