I have two dates:
Jun 26 2012 12:13AM and Jul 31 2012 12:54PM
I need to compare this two dates and extract Number of days(difference) between them
Using the DATEDIF Function DATEDIF function (derived from Date Difference) also allows you to quickly get the number of days between two dates.
return int(years / 4) - int(years / 100) + int(years / 400) # This function will return number of days between two given dates.
Use TimeSpan
TimeSpan difference = dateTime1 - dateTime2;
difference.TotalDays
will give you number of days
var days = difference.TotalDays;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With