Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Normally the solution would be simply:
(Remember to add one to the value of $month and 1900 to the value of $year before printing them out.) However, yesterday's date may not be twenty-four hours ago. The day on which daylight savings time (DST) ends is 25 hours long; the day on which DST begins is only 23 hours long. Thus if you calculated the date 24 hours earlier during the last hour of the day DST ended you would get an erroneous result using the above formula, i.e., "yesterday's" and today's dates would be the same. Similarly if you calculated the date 24 hours earlier during the first hour of the first whole day after DST began you would also get an erroneous result using the above formula: "yesterday's" date would be two days before today's date. 'perldoc perlfaq4' has a workaround by Russ Allbery that fixes the DST problem. Update: Corrected above to state that the formula at top would provide incorrect results in the last hour of the day DST ended, not the first hour of the day after it ended. In reply to Re: date
by sierrathedog04
|
|