How do you convert epoch time in to real time in C#?
+6
A:
I presume that you mean Unix time, which is defined as the number of seconds since midnight (UTC) on 1st January 1970 .
public DateTime FromUnixTime(double unixTime)
{
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return epoch.AddSeconds(unixTime);
}
LukeH
2010-05-21 16:04:43