Double - FromOADate
Returns a equivalent to the specified OLE Automation Date.
public static void Main() { var arr = new double[] { 39456, 39482, 39484, 39493, 39496, 39497, 39501, 39506, 39510, 39513, 39515, 39521, 36526, 36557, 39270 }; foreach (double val in arr) { // C# Extension Method: Double - FromOADate DateTime oaDate = val.FromOADate(); // Write to console. Console.WriteLine("{0} = {1}", val, oaDate.ToShortDateString()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns a equivalent to the specified OLE Automation Date. /// </summary> /// <param name="d">An OLE Automation Date value.</param> /// <returns>An object that represents the same date and time as .</returns> public static DateTime FromOADate(this Double d) { return DateTime.FromOADate(d); } }