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 that the number of days is 1 (because the trip happened on that day).
Like this:
If TripStartDate = 2011-03-04 09:35:00
and TripEndDate = 2011-03-05 09:35:00
, then the method should return after 2 days (because the trip occurred on both days).
If TripStartDate = 2011-03-04 09:35:00
and TripEndDate = 2011-04-04 09:35:00
, then the method should return 32 days. (because 28 days in March and 4 days in April).
The calculation should be based only on the dates and month of the year (not including time). Please help me. Thanks in advance...
source
share