in reply to Converting MySQL datetime values to DateTime objects
One thing I found helpful with PM is a simple regex that matches both a MySQL timestamp (which is a digit string) and MySQL datetime fields (which contains punctuation):
PerlMonks used to have separate code for dealing with timestamps vs. datetime fields.
Then you can construct nearly any date/time object you wish from the individual values.
Update: Gah! Serves me right for not looking at the code in question. The real/working code is more like:
Sorry! - tyemy( $cc, $yr, $mo, $day, $hr, $min, $sec )= $when =~ /(\d\d)/g; $yr += $cc*100;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Converting MySQL datetime values to DateTime objects (regex)
by LanceDeeply (Chaplain) on Jul 14, 2003 at 20:46 UTC | |
by dws (Chancellor) on Jul 14, 2003 at 20:52 UTC |