I'm having a few issues with converting a long Unix time to UTC Datetime in c#
public static DateTime FromUnixTime(long time1) //EPOCH TO UTC
{
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return epoch.AddMilliseconds(time1);
}
For example I have a time: 1372250710901
http://www.epochconverter.com/ says:
Assuming that this timestamp is in milliseconds:
GMT: Wed, 26 Jun 2013 12:45:10 GMT
Which is correct, my response is 26/06/2013 12:06:10.901
which is incorrect.
I'm sure I've missed something fantastically obvious but I've spent a while trawling the forums to work it out and failed miserably so if anyone can help that would be fantastic.