mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
docs: Correct the explanation of now()
To be honest, I don't understand the behavior of this function. The UNIX timestamp has nothing to do with time zone.
This commit is contained in:
parent
f9f606da65
commit
90dda258e5
@ -29,17 +29,18 @@ The following functions are available:
|
||||
:returns: UNIX timestamp
|
||||
:rtype: int
|
||||
|
||||
Returns the current time as a UNIX timestamp, referenced either to your server's
|
||||
local time or any PHP supported timezone, based on the "time reference" setting
|
||||
in your config file. If you do not intend to set your master time reference to
|
||||
any other PHP supported timezone (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.
|
||||
.. note:: It is recommended to use the :doc:`Time <../libraries/time>` class instead. Use ``Time::now()->getTimestamp()`` to get the current UNIX timestamp.
|
||||
|
||||
If a timezone is not provided, it will return the current UNIX timestamp by ``time()``.
|
||||
|
||||
.. literalinclude:: date_helper/002.php
|
||||
|
||||
If a timezone is not provided, it will return ``time()`` based on the
|
||||
**time_reference** setting.
|
||||
If any PHP supported timezone is provided, it will return a timestamp that is off by the time difference. It is not the same as the current UNIX timestamp.
|
||||
|
||||
If you do not intend to set your master time reference to
|
||||
any other PHP supported timezone (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:function:: timezone_select([$class = '', $default = '', $what = \DateTimeZone::ALL, $country = null])
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo now('Australia/Victoria');
|
||||
echo now();
|
||||
|
Loading…
x
Reference in New Issue
Block a user