Skip to content

Commit 77fa227

Browse files
committed
Fix chronos mistake.
1 parent 72d08ac commit 77fa227

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

en/core-libraries/time.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ addition of their components::
118118
$time = DateTime::create(2021, 1, 31, 22, 11, 30);
119119
$newTime = $time->subDays(5)
120120
->addHours(-2)
121-
->addMonth(1);
121+
->addMonths(1);
122122
// Outputs '2/26/21, 8:11 PM'
123123
echo $newTime;
124124

@@ -342,6 +342,7 @@ Conversion
342342
==========
343343

344344
.. php:method:: toQuarter()
345+
.. php:method:: toQuarterRange()
345346
346347
Once created, you can convert ``DateTime`` instances into timestamps or quarter
347348
values::
@@ -350,6 +351,19 @@ values::
350351
echo $time->toQuarter(); // Outputs '1'
351352
echo $time->toUnixString(); // Outputs '1612069200'
352353

354+
.. versionadded:: 5.3.0
355+
The ``toQuarterRange()`` method was added.
356+
357+
You can also get the date range for a quarter::
358+
359+
$time = new DateTime('2021-01-31');
360+
$range = $time->toQuarterRange();
361+
// Outputs ['2021-01-01', '2021-03-31']
362+
363+
$time = new DateTime('2021-12-25');
364+
$range = $time->toQuarterRange();
365+
// Outputs ['2021-10-01', '2021-12-31']
366+
353367
Comparing With the Present
354368
==========================
355369

0 commit comments

Comments
 (0)