As mentioned over in the
Dates thread, this will give you the wrong answer at least one hour a year if you're living in a timezone that switches to and from daylight savings time.
Update: After some research into this (and an experiment with Time::Local), I'm retracting my claim above, at least for the U.S. We do the timezone switch by either repeating 1am on the first Sunday of April, or by dropping 2am on the last Sunday of October. In either case, determining yesterday's date (but not time) can be done safely by subtracting 24 hours from the current time.
Subtracing 24 hours will indeed give the wrong answer
during a 1 hour window each year in the U.S. if you're
in an area that's doing a daylight savings switch.
Sat Mar 31 22:00:00 2001 < Sun Apr 1 23:00:00
Sat Mar 31 23:00:00 2001 < Mon Apr 2 00:00:00 *
Sun Apr 1 00:00:00 2001 < Mon Apr 2 01:00:00
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.