August 2018
Intermediate to advanced
366 pages
10h 14m
English
Usually what we want when moving datetime is to go to the beginning of a day. Suppose you want to find all events that happen tomorrow out of a list of events, you really want to search for day_after_tomorrow > event_time >= tomorrow as you want to find all events that happened from tomorrow at midnight up to the day after tomorrow at midnight.
So, simply changing the day itself won't work, because our datetime also has a time associated with it. If we just add a day to the date, we will actually end up being somewhere in the range of hours that are included in tomorrow.
That's the reason why the shiftdate function always replaces the time of the provided date with midnight.
Once the date has been moved to midnight, we just ...