summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/date_helper.php1
-rw-r--r--user_guide_src/source/changelog.rst4
-rw-r--r--user_guide_src/source/helpers/date_helper.rst7
-rw-r--r--user_guide_src/source/installation/upgrade_313.rst18
4 files changed, 28 insertions, 2 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 7f072acfa..0606a4562 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -496,6 +496,7 @@ if ( ! function_exists('nice_date'))
* Turns many "reasonably-date-like" strings into something
* that is actually useful. This only works for dates after unix epoch.
*
+ * @deprecated 3.1.3 Use DateTime::createFromFormat($input_format, $input)->format($output_format);
* @param string The terribly formatted date-like string
* @param string Date format to return (same as php date function)
* @return string
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index fd3f668cf..af556a50a 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -7,6 +7,10 @@ Version 3.1.3
Release Date: Not Released
+- General Changes
+
+ - Deprecated :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()`.
+
Bug fixes for 3.1.3
-------------------
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index a85da26a4..600a07574 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -84,7 +84,7 @@ The following functions are available:
.. note:: This function is DEPRECATED. Use the native ``date()`` combined with
`DateTime's format constants
- <http://php.net/manual/en/class.datetime.php#datetime.constants.types>`_
+ <https://secure.php.net/manual/en/class.datetime.php#datetime.constants.types>`_
instead::
echo date(DATE_RFC822, time());
@@ -220,6 +220,9 @@ The following functions are available:
// Should Produce: 2001-09-11
$better_date = nice_date($bad_date, 'Y-m-d');
+ .. note:: This function is DEPRECATED. Use PHP's native `DateTime class
+ <https://secure.php.net/datetime>`_ instead.
+
.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]])
:param int $seconds: Number of seconds
@@ -434,4 +437,4 @@ UP12 (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand
UP1275 (UTC +12:45) Chatham Islands Standard Time
UP13 (UTC +13:00) Phoenix Islands Time, Tonga
UP14 (UTC +14:00) Line Islands
-=========== ===================================================================== \ No newline at end of file
+=========== =====================================================================
diff --git a/user_guide_src/source/installation/upgrade_313.rst b/user_guide_src/source/installation/upgrade_313.rst
index 71afc6f6a..ebce7ab9b 100644
--- a/user_guide_src/source/installation/upgrade_313.rst
+++ b/user_guide_src/source/installation/upgrade_313.rst
@@ -12,3 +12,21 @@ Replace all files and directories in your *system/* directory.
.. note:: If you have any custom developed files in these directories,
please make copies of them first.
+
+Step 2: Remove usage of nice_date() helper (deprecation)
+========================================================
+
+The :doc:`Date Helper <../helpers/date_helper>` function ``nice_date()`` is
+no longer useful since the introduction of PHP's `DateTime classes
+<https://secure.php.net/datetime>`_
+
+You can replace it with the following:
+::
+
+ DateTime::createFromFormat($input_format, $input_date)->format($desired_output_format);
+
+Thus, ``nice_date()`` is now deprecated and scheduled for removal in
+CodeIgniter 3.2+.
+
+.. note:: The function is still available, but you're strongly encouraged
+ to remove its usage sooner rather than later.