On Tuesday, April 9, 2002, at 10:19 AM, Schroeter, Richard wrote:
> Greetings, > I am having a problem with Perl providing me the correct date when I > subtract 86400 from the date. This is only happening when I set the > computer's system's date to today's date. If I set the system's date to > tomorrows date or yesterday's date it works fine. My code is: > > $TIME = timelocal (0,0,0,$end_day,$calc_month,$calc_year); > $new_time = $TIME - 86400; > ($sec,$min,$hr,$dom,$month,$year,$wday,$yday,$isdst) = > localtime($new_time); > $yday = sprintf("%02d:,$dom); > string isn't terminated with a doublequote. (assuming the colon is supposed to be there and isn't supposed the doublequote.) > $yyear = $year + 1900; > $ymonth = sprintf("02d:,$month + 1); same as above. string isn't terminated. also, no leading '%' for the format. i assume these are typos in email, since your code wouldn't work as written here. > $today = $ymonth.$end_day; > $yesterday = $ymonth.$yday; > > I am running Windows NT. > > When I run this with my system = today's date(04/09) $today = 0408, > $yesterday = 0406. ($yesterday should be 0407) > When I run this with my system = yesterday's date (04/08) $today = 0407, > $yesterday = 0406. > when I run this with my system = tomorrow's date (04/10) $today = 0409, > $yesterday = 0408. > when i run something like you have for today (4/9), i get yesterday is 0408. > Thank you for your help, > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]