Possibly the only really useful int
extension method I’ve ever written.
Convert an epoch (unix date) to a formatted string:
[csharp]
public static class DateExtensions
{
public static string StringDateFromUnixTime(this int unixTime)
{
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var dt = epoch.AddSeconds(unixTime);
return dt.ToString("yyyy-MM-dd hh:mm:ss.fff");
}
}
[/csharp]