You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/helpers/date_helper.rst
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ dates.
9
9
:local:
10
10
:depth: 2
11
11
12
+
.. note:: Many functions previously found in the CodeIgniter 3 ``date_helper`` have been moved to the :doc:`Time <../libraries/time>` class in CodeIgniter 4.
13
+
12
14
Loading this Helper
13
15
===================
14
16
@@ -27,17 +29,18 @@ The following functions are available:
27
29
:returns: UNIX timestamp
28
30
:rtype: int
29
31
30
-
Returns the current time as a UNIX timestamp, referenced either to your server's
31
-
local time or any PHP supported timezone, based on the "time reference" setting
32
-
in your config file. If you do not intend to set your master time reference to
33
-
any other PHP supported timezone (which you'll typically do if you run a site
34
-
that lets each user set their own timezone settings) there is no benefit to using
35
-
this function over PHP's ``time()`` function.
32
+
.. note:: It is recommended to use the :doc:`Time <../libraries/time>` class instead. Use ``Time::now()->getTimestamp()`` to get the current UNIX timestamp.
33
+
34
+
If a timezone is not provided, it will return the current UNIX timestamp by ``time()``.
36
35
37
36
.. literalinclude:: date_helper/002.php
38
37
39
-
If a timezone is not provided, it will return ``time()`` based on the
40
-
**time_reference** setting.
38
+
If any PHP supported timezone is provided, it will return a timestamp that is offset by the time difference. It is not the same as the current UNIX timestamp.
39
+
40
+
If you do not intend to set your master time reference to
41
+
any other PHP supported timezone (which you'll typically do if you run a site
42
+
that lets each user set their own timezone settings) there is no benefit to using
0 commit comments