How to convert the time to C #?


How do you convert Unix epoch time into real time in C#? (Epoch beginning 1/1/1970)

I presume that you mean Unix time, which is defined as the number of seconds since midnight (UTC) on 1st January 1970.

public static DateTime FromUnixTime(long unixTime)
    return epoch.AddSeconds(unixTime);
private static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);