We help IT Professionals succeed at work.

daylight savings q

i have a function that finds out the elapsed time in minutes between start and end dates and times.
This does not take into consideration dayligght savings.
anyone know how i can get my app to be aware of this?
Watch Question

daylight saving time is arbitrary..it starts and ends at
different dates at different places...some places refuse to change time.
( I agree with those ... it is a really stupid thing).

For a given locale you could note the date and time of the change and then adjust your result. For your elapsed time result the important thing is the start date and the end date... note that if you are getting elapsed time over a period of years then the "Spring foreward, Fall back" resetting of the clock should cancel out in the intervening years. Also the start and end times are subject to a possible problem...I think it is 2:00 am on a Sunday morning when the change takes effect in most places.

I assume your technique gets the time from the PC, but the time on the date of change is usually not adjusted until you respond to your OS that asks if you want to adjust your time.....many possible confusion factors.

Also daylight saving time only started sometime during
WW2 so your technique must recognize a date before which
there was no such stupid change of time.....that date is not the same for all places.

In general I think you would have a possible one hour or
two hour adjustment with which to deal. The only sort of cases that might be important are the elapsed time for a period that starts before and ends after a time change in which case plus or minus 60 minutes must be adjusted.


Explore More ContentExplore courses, solutions, and other research materials related to this topic.