From 7bf0a4ff35efc758ef43b3a848e655285946b8b6 Mon Sep 17 00:00:00 2001 From: Iban Eguia Date: Tue, 27 Mar 2012 18:36:15 +0200 Subject: Added doccumentation for the new date helper. --- system/helpers/date_helper.php | 4 +++- user_guide_src/source/changelog.rst | 1 + user_guide_src/source/helpers/date_helper.rst | 22 ++++++++++++++-------- user_guide_src/source/installation/upgrade_300.rst | 6 ++++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index aecc7d90f..7ff7444e5 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -40,8 +40,10 @@ /** * Get "now" time * - * Returns time() or its GMT equivalent based on the config file preference + * Returns time() based on the timezone parameter or on the "timezone" + * setting * + * @param string * @return int */ if ( ! function_exists('now')) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index b4bf0cfaa..e5b6eea47 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -40,6 +40,7 @@ Release Date: Not Released - Helpers + - Date helper will now return now() based on the timezone you specify. - url_title() will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. - Changed humanize to include a second param for the separator. diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index b21d147bd..b8c3dd076 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -20,14 +20,20 @@ The following functions are available: now() ===== -Returns the current time as a Unix timestamp, referenced either to your -server's local time or GMT, based on the "time reference" setting in -your config file. If you do not intend to set your master time reference -to GMT (which you'll typically do if you run a site that lets each user -set their own timezone settings) there is no benefit to using this -function over PHP's time() function. - -.. php:method:: now() +Returns the current time as a Unix timestamp, based on the "timezone" parameter. +All PHP available timezones are supported. + +.. php:method:: now($timezone = NULL) + + :param string $timezone: The timezone you want to be returned + :returns: integer + +:: + + $tz = "Australia/Victoria"; + echo now($tz); + +If a timezone is not provided, it will return time() based on "timezone" setting. mdate() ======= diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index 4c594ab17..b6f52080a 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -31,3 +31,9 @@ Step 3: Remove $autoload['core'] from your config/autoload.php Use of the `$autoload['core']` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed. Move any entries that you might have listed there to `$autoload['libraries']` instead. + +Step 4: Change your use of the Date heper's now() function +========================================================== + +Function now() has been modified. You can see the changes in :doc:`Date Helper <../helpers/date_helper>` +You must replace $config['time_reference'] with $config['timezone']. \ No newline at end of file -- cgit v1.2.3-24-g4f1b