Difficulties with Daylight Saving Time seem fairly common.
Another source of difficulties is month numbering. It seems that in the old DateTime library, months are numbered 0 to 11 (yes, I hate this too); whereas in the more recent Time library, the month numbering is from 1 to 12. Which library are you using? (Test: what day comes after 6/30 ? Is it 6/31 or 7/1 ?)
"Thirty days hath September" - numeric version:Fourth, eleventh, ninth, and sixth,
Thirty days to each affix;
Every other thirty-one
Except the second month alone.
Assuming you have month numbering taken care of, that leaves Daylight Saving Time.
The way I handle adjustment of my clock for Daylight Saving Time is I don't. Internally, the clock keeps "winter" time all year. When Daylight Saving Time is in effect, I simply display
a time that is one hour later. I made a set of functions to handle this, but it is probably more than you need. Instead is a list of faux "Unix Time" values when the change happens. All of these values are in local "winter" time. If your time value is greater than the first number in some pair but less than the second, add 3600 before converting to human units for display.
- Code: Select all | TOGGLE FULL SIZE
// these are for the U.S. Daylight Saving Time rule
// DST start & end moments, in faux "Unix Time"
// start with 2013
// this will get you through 2028