>Yes.  There are 2 hours each year when this formula is wrong.

No, there are 2 hours each year where the 'time' fields wouldn't be exactly
24 hours earlier, but the date should be skookum

> More seriously, isn't this code subtracting a day twice?

>>>> my ($mday, $mon, $year) = (localtime(time() - 60 * 60 * 24) )[ 3,4,5];
>>>> printf("%d/%02d/%02d\n", $year + 1900, $mon + 1, $mday - 1);

> I would think that the first, subtracting from time() would be the
correct one--the one that would overcome changes in month, year, and time,
while the second, from $mday's value, is not just redundant, but at this
point, wrong, no?

Right, that's my typo-thinko - I was looking at trying to show the "$mday -
1" route and the attendant issues w/ first day of month etc. and then
compressed it to the better just sub the day's worth of seconds.

printf("%d/%02d/%02d\n", $year + 1900, $mon + 1, $mday);


> On a picky note, wouldn't it be easier to just subtract 86400?

Yes/no - 86400 isn't *that* meaningful to most normal folks (though I
should consider the audience) but 60*60*24 sort of documents where the
result comes from.  Sort of.

a

-------------------
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
Voice: (608) 261-5738 Fax: 264-5932

When I retire, I'm going to spend my evenings by the fireplace, going
through those boxes.  There are things in there that ought to be burned.
Richard Millhouse Nixon (Parade magazine)

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to