diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-14 12:35:32 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-14 12:35:32 +0200 |
commit | 3bbbd26ecb60966b07c597310ae241c432bce198 (patch) | |
tree | e2b8456f9b89d3bea6efb3ce67573ccd56bd6b1f | |
parent | 3ed533109309326a858c778dfea5cb9186f965b4 (diff) |
Some optimizations to the date helper
-rw-r--r-- | system/helpers/date_helper.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index a5c46e47b..d5036f645 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -314,13 +314,13 @@ if ( ! function_exists('local_to_gmt')) $time = time(); } - return mktime( - gmdate('H', $time), - gmdate('i', $time), - gmdate('s', $time), - gmdate('m', $time), - gmdate('d', $time), - gmdate('Y', $time) + return gmmktime( + date('H', $time), + date('i', $time), + date('s', $time), + date('m', $time), + date('d', $time), + date('Y', $time) ); } } @@ -375,9 +375,7 @@ if ( ! function_exists('mysql_to_unix')) // since the formatting changed with MySQL 4.1 // YYYY-MM-DD HH:MM:SS - $time = str_replace('-', '', $time); - $time = str_replace(':', '', $time); - $time = str_replace(' ', '', $time); + $time = str_replace(array('-', ':', ' '), '', $time); // YYYYMMDDHHMMSS return mktime( |