I have a subroutine whose original intent was to mung the date so as to name a file based on whatever the date is of the Friday of the given week. So that, for example, if it's Wednesday 10/4/2000, the file gets gets titled 10_6_2000.html (with the idea that it's appended to after that).
It worked fine up to some unspecified time ago (I only found out it was broken when one of my users reported a different problem entirely). Now it's telling me that Friday is 9/28/2000. Here's the code in question:
$now = time(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$rest) = localtime($now); if ($wday !=4) { $dow = $wday; if ($dow < 4) { $dow += 7; } $then = (($dow - 4) * 60 * 60 * 24); } ($sec,$min,$hour,$mday,$mon,$year,$rest) = localtime($now - $then); $mon=$mon+1; $year=$year+1900;
Why's it not working? Should it have ever worked??
Thanks for your attention.
- Muse
In reply to Date munging suddenly broken by motomuse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |