Saturday, May 30, 2009

DateTime to double and vice vers

// DateTime to double and vice versa

public static double ToDouble(DateTime what)
{
return BitConverter.ToDouble(BitConverter.GetBytes(what.Ticks), 0);
}

public static DateTime ToDateTime(double what)
{
return new DateTime(BitConverter.ToInt64(BitConverter.GetBytes(what), 0));
}

No comments:

Post a Comment