in reply to Time local
The format for $app_date that you give appears to be month-day-year (or day-month-year—I can't tell which), but your code thinks it's year-month-day. I think your second line down should be:
($amonth,$aday,$ayear) = split(/-/, $adate);
Pulling those fields out of your input might be a little more readable with regular expressions. You could replace all of your split lines with this (unless you need $adate or $atime later):
( $amonth, $aday, $ayear, $ahour, $amin, $asec ) = ( $app_date =~ /^(\d\d?)-(\d\d?)-(\d{4}) (1?\d):(\d\d):(\d\d)/ ) +;
Or this, if you're into xms regexes:
( $amonth, $aday, $ayear, $ahour, $amin, $asec ) = ( $app_date =~ m{ \A # beginning of string (\d\d?)-(\d\d?)-(\d{4}) # month-day-year \s # space separator (1?\d):(\d\d):(\d\d) # hour:minutes:seconds }xms );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Time local
by Anonymous Monk on Dec 21, 2006 at 18:26 UTC | |
by ikegami (Patriarch) on Dec 21, 2006 at 18:27 UTC |