File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,27 @@ The Clock component also provides the ``now()`` function::
6363 // Get the current time as a DateTimeImmutable instance
6464 $now = now();
6565
66+ The ``now() `` function takes an optional ``modifier `` argument
67+ which will be applied to the current time::
68+
69+ $later = now('+3 hours');
70+
71+ $yesterday = now('-1 day');
72+
73+ You can use any string `accepted by the DateTime constructor `_.
74+
6675Later on this page you can learn how to use this clock in your services and tests.
6776
6877.. versionadded :: 6.3
6978
7079 The :class: `Symfony\\ Component\\ Clock\\ Clock ` class and ``now() `` function
7180 were introduced in Symfony 6.3.
7281
82+ .. versionadded :: 6.4
83+
84+ The ``modifier `` argument of the ``now() `` function was introduced in
85+ Symfony 6.4.
86+
7387Available Clocks Implementations
7488--------------------------------
7589
@@ -252,3 +266,4 @@ control on your time-sensitive code's behavior.
252266 The :class: `Symfony\\ Component\\ Clock\\ Test\\ ClockSensitiveTrait ` was introduced in Symfony 6.3.
253267
254268.. _`PSR-20` : https://www.php-fig.org/psr/psr-20/
269+ .. _`accepted by the DateTime constructor` : https://www.php.net/manual/en/datetime.formats.php
You can’t perform that action at this time.
0 commit comments