// 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; using System.Globalization; namespace E { public class Program { public static void Main(string[] args) { DateTime dt1 = DateTime.ParseExact("01012009 23:00:00", "ddMMyyyy HH:mm:ss", null); DateTime dt2 = DateTime.ParseExact("03012009 01:00:00", "ddMMyyyy HH:mm:ss", null); Console.WriteLine(dt1 + " " + dt2); int days = (int)(dt2.Date - dt1.Date.AddHours(24)).TotalDays; Console.WriteLine(days); } } }