// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Program { public static int DateTimeToInt(DateTime theDate) { return (int)(theDate.Date - new DateTime(1900, 1, 1)).TotalDays + 2; } public static int XDateTimeToInt(DateTime theDate) { return (int)theDate.ToOADate(); } public static void Main(string[] args) { DateTime dt = DateTime.Now; int v; int xv; do { v = DateTimeToInt(dt); xv = XDateTimeToInt(dt); if(v != xv) { Console.WriteLine("{0} {1} {2}", dt, v, xv); } dt = dt.AddDays(-1); } while(v > 0); Console.WriteLine("Done"); Console.ReadKey(); } } }