From UnixTime to DateTime and back
Here are a couple of functions that allow you to convert from UnixTime to DateTime and back
public class Util {
private static DateTime UnixTime
{
get { return new DateTime(1970, 1, 1); }
}
public static DateTime FromUnixTime( double unixTime )
{
return UnixTime.AddSeconds( unixTime );
}
public static double ToUnixTime( DateTime dateTime )
{
TimeSpan timeSpan = dateTime -- UnixTime;
return timeSpan.TotalSeconds;
}
}