diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-10-05 22:11:42 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-10-05 22:11:42 +0200 |
commit | dc9bfb7ffbbd53fa4ad0c22c8c42300dd882ecca (patch) | |
tree | b156ecf867856a0d88dacc3f32c35bafc85fb054 /user_guide_src | |
parent | dbad54e09a39a77c7404dee9ca1a6b34299469d0 (diff) | |
parent | 0df3585eec575d2d2e7d17c5339ed219a33dfde8 (diff) |
Merge pull request #918 from narfbg/develop-dh-date-range
Added date_range() to the Date helper
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 5 | ||||
-rw-r--r-- | user_guide_src/source/helpers/date_helper.rst | 24 |
2 files changed, 27 insertions, 2 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 40ba218a8..486a67696 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -60,7 +60,8 @@ Release Date: Not Released - ``now()`` now works with all timezone strings supported by PHP. - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed. - Added an optional parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag. - - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://bg2.php.net/manual/en/class.datetime.php#datetime.constants.types>`_. + - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_. + - Added function ``date_range()`` that generates a list of dates between a specified period. - ``create_captcha()`` accepts additional colors parameter, allowing for color customization. - :doc:`URL Helper <helpers/url_helper>` changes include: - ``url_title()`` will now trim extra dashes from beginning and end. @@ -75,7 +76,7 @@ Release Date: Not Released - Added a work-around in ``force_download()`` for a bug Android <= 2.1, where the filename extension needs to be in uppercase. - ``form_dropdown()`` will now also take an array for unity with other form helpers. - ``do_hash()`` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. - - Removed previously deprecated helper function ``js_insert_smiley()`` from smiley helper. + - Removed previously deprecated helper function ``js_insert_smiley()`` from :doc:`Smiley Helper <helpers/smiley_helper>`. - :doc:`File Helper <helpers/file_helper>` changes include: - ``set_realpath()`` can now also handle file paths as opposed to just directories. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index e332a913f..9de925ba7 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -306,6 +306,30 @@ Example If the second parameter is empty, the current year will be used. +date_range() +============ + +Returns a list of dates within a specified period. + +.. php:method:: date_range($unix_start = '', $mixed = '', $is_unix = TRUE, $format = 'Y-m-d') + + :param integer $unix_start: UNIX timestamp of the range start date + :param integer $mixed: UNIX timestamp of the range end date or interval in days + :param boolean $is_unix: set to FALSE if $mixed is not a timestamp + :param string $format: output date format, same as in date() + :returns: array + +Example + +:: + + $range = date_range('2012-01-01', '2012-01-15'); + echo "First 15 days of 2012:"; + foreach ($range as $date) + { + echo $date."\n"; + } + timezones() =========== |