I am calculating the difference between two sql dates, TripStartDate
and TripEndDate
.
If TripStartDate= 2011-03-04 09:35:00
and TripEndDate = 2011-03-04 10:35:00
then I should get the number of day is 1 (because trip happened on that day).
Like this:
If TripStartDate = 2011-03-04 09:35:00
and TripEndDate = 2011-03-05 09:35:00
then method should return 2 days (because trip happened on both days).
If TripStartDate = 2011-03-04 09:35:00
and TripEndDate = 2011-04-04 09:35:00
then method should return 32 days. (because 28 days in march and 4 days in April).
Calculation should be based on only dates and month of year (not taking time in consideration). Please help me . Thanks in advance...