From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/helpers/date_helper.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/helpers/date_helper.php') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index e14bc2f94..447bf55ac 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 * @filesource @@ -21,7 +33,7 @@ * @package CodeIgniter * @subpackage Helpers * @category Helpers - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/helpers/date_helper.html */ -- cgit v1.2.3-24-g4f1b From 6d638537a249eb7b2f1b25df8f4f4979c8debbc4 Mon Sep 17 00:00:00 2001 From: Syahril Zulkefli Date: Sun, 13 Nov 2011 23:41:37 +0800 Subject: Fix invalid date format --- system/helpers/date_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/date_helper.php') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 447bf55ac..b8c2eb58d 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -132,7 +132,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%i UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', -- cgit v1.2.3-24-g4f1b From 90658ad344a428fb031bd34c57458fc15618060d Mon Sep 17 00:00:00 2001 From: Syahril Zulkefli Date: Sun, 13 Nov 2011 23:43:37 +0800 Subject: Fix invalid date format --- system/helpers/date_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/date_helper.php') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index b8c2eb58d..8c92fdc89 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -132,7 +132,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', -- cgit v1.2.3-24-g4f1b From dc3e4bedb39afe30d95635e5258aaecec4dfd74c Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 19 Dec 2011 13:48:29 -0500 Subject: Fixed year and month seconds for timespan(). --- system/helpers/date_helper.php | 70 +++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'system/helpers/date_helper.php') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 8c92fdc89..49dbdbeb3 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -96,14 +96,14 @@ if ( ! function_exists('mdate')) { if ($datestr == '') { - return ''; + return ''; } $time = ($time == '') ? now() : $time; $datestr = str_replace( - '%\\', - '', + '%\\', + '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr) ); @@ -181,15 +181,15 @@ if ( ! function_exists('timespan')) $seconds = ($time <= $seconds) ? 1 : $time - $seconds; $str = ''; - $years = floor($seconds / 31536000); + $years = floor($seconds / 31557600); if ($years > 0) { $str .= $years.' '.$CI->lang->line((($years > 1) ? 'date_years' : 'date_year')).', '; } - $seconds -= $years * 31536000; - $months = floor($seconds / 2628000); + $seconds -= $years * 31557600; + $months = floor($seconds / 2629743); if ($years > 0 OR $months > 0) { @@ -198,7 +198,7 @@ if ( ! function_exists('timespan')) $str .= $months.' '.$CI->lang->line((($months > 1) ? 'date_months' : 'date_month')).', '; } - $seconds -= $months * 2628000; + $seconds -= $months * 2629743; } $weeks = floor($seconds / 604800); @@ -315,13 +315,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("H", $time), + gmdate("i", $time), + gmdate("s", $time), + gmdate("m", $time), + gmdate("d", $time), gmdate("Y", $time) ); } @@ -494,17 +494,17 @@ if ( ! function_exists('human_to_unix')) if (substr($ampm, 0, 1) == 'p' AND $hour < 12) { - $hour = $hour + 12; + $hour = $hour + 12; } if (substr($ampm, 0, 1) == 'a' AND $hour == 12) { $hour = '00'; } - + if (strlen($hour) == 1) { - $hour = '0'.$hour; + $hour = '0'.$hour; } } @@ -517,7 +517,7 @@ if ( ! function_exists('human_to_unix')) /** * Turns many "reasonably-date-like" strings into something * that is actually useful. This only works for dates after unix epoch. - * + * * @access public * @param string The terribly formatted date-like string * @param string Date format to return (same as php date function) @@ -525,7 +525,7 @@ if ( ! function_exists('human_to_unix')) */ if ( ! function_exists('nice_date')) { - function nice_date($bad_date = '', $format = FALSE) + function nice_date($bad_date = '', $format = FALSE) { if (empty($bad_date)) { @@ -533,47 +533,47 @@ if ( ! function_exists('nice_date')) } // Date like: YYYYMM - if (preg_match('/^\d{6}$/', $bad_date)) + if (preg_match('/^\d{6}$/', $bad_date)) { - if (in_array(substr($bad_date, 0, 2),array('19', '20'))) + if (in_array(substr($bad_date, 0, 2),array('19', '20'))) { $year = substr($bad_date, 0, 4); $month = substr($bad_date, 4, 2); - } - else + } + else { $month = substr($bad_date, 0, 2); $year = substr($bad_date, 2, 4); } - + return date($format, strtotime($year . '-' . $month . '-01')); } - + // Date Like: YYYYMMDD - if (preg_match('/^\d{8}$/',$bad_date)) + if (preg_match('/^\d{8}$/',$bad_date)) { $month = substr($bad_date, 0, 2); $day = substr($bad_date, 2, 2); $year = substr($bad_date, 4, 4); - + return date($format, strtotime($month . '/01/' . $year)); } - + // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/',$bad_date)) - { + { list($m, $d, $y) = explode('-', $bad_date); return date($format, strtotime("{$y}-{$m}-{$d}")); } - + // Any other kind of string, when converted into UNIX time, // produces "0 seconds after epoc..." is probably bad... // return "Invalid Date". if (date('U', strtotime($bad_date)) == '0') - { + { return "Invalid Date"; } - + // It's probably a valid-ish date format already return date($format, strtotime($bad_date)); } @@ -688,9 +688,9 @@ if ( ! function_exists('timezones')) { return $zones; } - + $tz = ($tz == 'GMT') ? 'UTC' : $tz; - + return ( ! isset($zones[$tz])) ? 0 : $zones[$tz]; } } -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/helpers/date_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/date_helper.php') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 49dbdbeb3..9e58d8630 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b