diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
commit | 0854d91fd2848266ec37a37c8a1ccfd13a8a4eda (patch) | |
tree | 1433f1db86920fae6e6286c6cc517ba64cda2aba /system/helpers/date_helper.php | |
parent | 0cb8c59f91567af9aa6530f8764abafe1ae935c0 (diff) | |
parent | 3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff) |
Merged tip.
Diffstat (limited to 'system/helpers/date_helper.php')
-rw-r--r-- | system/helpers/date_helper.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 553e8d7ee..f3f01f751 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -69,7 +69,7 @@ if ( ! function_exists('now')) * This function is identical to PHPs date() function, * except that it allows date codes to be formatted using * the MySQL style, where each code letter is preceded - * with a percent sign: %Y %m %d etc... + * with a percent sign: %Y %m %d etc... * * The benefit of doing dates this way is that you don't * have to worry about escaping your text letters that @@ -366,7 +366,7 @@ if ( ! function_exists('mysql_to_unix')) $time = str_replace(' ', '', $time); // YYYYMMDDHHMMSS - return mktime( + return mktime( substr($time, 8, 2), substr($time, 10, 2), substr($time, 12, 2), @@ -394,7 +394,7 @@ if ( ! function_exists('unix_to_human')) { function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us') { - $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; + $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; if ($fmt == 'us') { @@ -451,18 +451,18 @@ if ( ! function_exists('human_to_unix')) $ex = explode("-", $split['0']); - $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; - $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; - $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; + $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; + $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; + $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; $ex = explode(":", $split['1']); $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0']; - $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; + $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2'])) { - $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; + $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; } else { @@ -478,7 +478,7 @@ if ( ! function_exists('human_to_unix')) $hour = $hour + 12; if (substr($ampm, 0, 1) == 'a' AND $hour == 12) - $hour = '00'; + $hour = '00'; if (strlen($hour) == 1) $hour = '0'.$hour; @@ -537,7 +537,7 @@ if ( ! function_exists('timezone_menu')) /** * Timezones * - * Returns an array of timezones. This is a helper function + * Returns an array of timezones. This is a helper function * for various other ones in this library * * @access public |