in reply to Re^2: Regexp Epiphany
in thread Regex Epiphany
How can it? You lose information. That strings contains nothing else that would indicate whether the times are AM or PM. Date::Manip is probably assuming 24-hour-time, effectively assuming AM for all times.
Did you actually test your assumption or are you simply programming by coincidence?
$ perl -MDate::Manip -le'print UnixDate "Wed, 28 Jul 2004 9:12 PM", "% +s"' 1091041920 $ perl -MDate::Manip -le'print UnixDate "Wed, 28 Jul 2004 9:12", "%s"' 1090998720
You didn't notice that, because you're not asking for the time, only for the date. Are you sure you will never want to see the time, in a future change to the script? Will you remember this idiosyncracy of your solution at the time? You should at least document this issue in your script; the better approach would of course be to either strip the entire time out of the string completely (Date::Manip will assume 12AM sharp) or not to destroy this information in the first place.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regexp Epiphany
by Sigmund (Pilgrim) on Aug 23, 2004 at 09:20 UTC |