From 36591099aa01107294f8b2794351b078b7575a25 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 5 Mar 2010 10:05:51 -0600 Subject: little cleaner regex in human_to_unix() --- system/helpers/date_helper.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/helpers/date_helper.php') 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']); -- cgit v1.2.3-24-g4f1b