Convert Date to OADate and OADate To DateTime

ToOADate (OLE Automation Date) returns a double value which represents the amont of days from 12:00 AM, 30 December 1899. It will process negative double values and so 12:00 AM, 30 December 1899 is not the minimum value it is the middle. Now lets look at some real code. 

Note: ToOADate returns a double the whole part represents the day and the decimal part represents the time. 

double variable = object.ToOADate();[edit] Example 1:
using System;
class Program
{
    static void Main()
    {
        DateTime MyDate = new DateTime(1904, 12, 12, 1,4,1);
        double MyDouble = MyDate.ToOADate();
        Console.WriteLine(MyDouble);
        Console.Read();
    }
}

Output: 

1808.04445601852

Now that you have converted a date to a ToOADate you must know how to convert it back to a regular datetime format. Here is how. 

using System;
class Program
{
    static void Main()
    {
        double MyOADate = 831.01289631332;
        DateTime MyDate = DateTime.FromOADate(MyOADate);
        Console.WriteLine(MyDate.ToString());
        Console.Read();
    }
}

Output: 

4/10/1902 12:18:34 AM