[英]Convert facebook date time to C# date time
Hi i have notice there two date times facebook gives, one is a date time from Unix Epoch and other is RFC 3339 Datetime (if i am not wrong). 嗨,我注意到Facebook提供了两个日期时间,一个是Unix Epoch的日期时间,另一个是RFC 3339日期时间(如果我没有记错的话)。 I wanted to know what is the best way to convert between each other.
我想知道什么是彼此之间进行转换的最佳方法。 I have tried DateTime.TryParse() method but some times it dosent return the correct parsed date.
我已经尝试过DateTime.TryParse()方法,但有时它会返回正确的解析日期。 Like it gives
21-Dec-2010 7:21:56 AM
for 2010-12-21T01:51:56+0000
. 就像它为
2010-12-21T01:51:56+0000
给出了21-Dec-2010 7:21:56 AM
。 But it seems it doesn't parse time correctly. 但似乎无法正确解析时间。 So plese tell how to change between epoch times and above datetime in C# datetime.
因此,请讲讲如何在C#datetime中的纪元时间和datetime之间进行更改。
DateTime.Parse
is converting a UTC date to your local timezone. DateTime.Parse
正在将UTC日期转换为您的本地时区。
To retrieve the original UTC date, call ToUniversalTime()
. 要获取原始UTC日期,请调用
ToUniversalTime()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.