in reply to Date processor
I know this looks a lot more like "baby talk Perl", but ask yourself which one you can read more easily without background info. Also ask yourself which one is easier to change if your date format (into or out of this function) ever changes.my $time_stamp = "2-19-01 3:22 PM"; my($date, $time, $am_pm) = split(/ /, $time_stamp); my($month, $day, $short_year) = split(/-/, $date); my($hours, $min) = split(/:/, $time); if ($am_pm =~ /pm/i) { $hours += 12; } my $year = 2000 + short_year; my $sql_time_stamp = "$year-$month-$day $hours:$min"
|
|---|