in reply to Re: Date Manipulation
in thread Date Manipulation

The DST-safe algorithm I use for calculating the daydate of yesterday or other relative date descriptions is to add/subtract 22 hours from the current gmtime() or localtime() until the date or day of week changes - this is a much simpler (and easier to debug) loop than maintaining any carry.

Replies are listed 'Best First'.
Re^3: Date Manipulation
by swampyankee (Parson) on Dec 18, 2006 at 15:33 UTC

    I'm lazy. In Perl, I use one of the date modules. In Fortran -- where I did implement something like this -- DST adds another layer of horror that I contemplated and decided to ignore; nobody where I work is likely to be working between 6pm and 7am, so DST wasn't an issue. My general opinion of DST is f*** it, in any case.

    emc

    At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

    —Igor Sikorsky, reported in AOPA Pilot magazine February 2003.