Mahmoud ElMansy: knowledge meant to be free

Calculate the number of days between two dates in C#

Simple way to Calculate the date the separtates two dates .

DateTime date1 = DateTime.Now.AddDays(1), date2 = DateTime.Now;
            Console.WriteLine((date1 - date2).TotalDays);
            Console.WriteLine((date1 - date2).TotalHours);
            Console.WriteLine((date1 - date2).TotalMinutes);
            Console.WriteLine((date1 - date2).TotalSeconds);
            Console.WriteLine((date1 - date2).TotalMilliseconds);
            Console.WriteLine((date1 - date2).Days);
            Console.WriteLine((date1 - date2).Hours);
            Console.WriteLine((date1 - date2).Minutes);
            Console.WriteLine((date1 - date2).Seconds);
            Console.WriteLine((date1 - date2).Milliseconds);

The difference between TotalDays and Days .
TotalDays return double the exact different .
Days return the different .