diff options
author | Derek Jones <derek.jones@ellislab.com> | 2010-03-05 17:05:51 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2010-03-05 17:05:51 +0100 |
commit | 36591099aa01107294f8b2794351b078b7575a25 (patch) | |
tree | a08561ec95415742812a1588f6706ef69f9e14bd /system | |
parent | 9d653edd03fcc325e94a2c9da36eb250f2a8f889 (diff) |
little cleaner regex in human_to_unix()
Diffstat (limited to 'system')
-rw-r--r-- | system/helpers/date_helper.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 0e9781666..2c60f0302 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -288,7 +288,7 @@ if ( ! function_exists('days_in_month')) return $days_in_month[$month - 1]; } } - + // ------------------------------------------------------------------------ /** @@ -343,7 +343,7 @@ if ( ! function_exists('gmt_to_local')) return $time; } } - + // ------------------------------------------------------------------------ /** @@ -440,14 +440,14 @@ if ( ! function_exists('human_to_unix')) } $datestr = trim($datestr); - $datestr = preg_replace("/\040+/", "\040", $datestr); - + $datestr = preg_replace("/\040+/", ' ', $datestr); + if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr)) { return FALSE; } - - $split = preg_split("/\040/", $datestr); + + $split = explode(' ', $datestr); $ex = explode("-", $split['0']); |