Pergunta

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). 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. Like it gives 21-Dec-2010 7:21:56 AM for 2010-12-21T01:51:56+0000. But it seems it doesn't parse time correctly. So plese tell how to change between epoch times and above datetime in C# datetime.

Foi útil?

Solução

DateTime.Parse is converting a UTC date to your local timezone.
To retrieve the original UTC date, call ToUniversalTime().

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top