@@ -85,7 +85,7 @@ Given separate inputs for **year**, **month**, and **day**, will return a new in
8585are not provided, it will use the current value to fill it in. Accepts strings for the timezone and locale in the
8686fourth and fifth parameters::
8787
88- $today = Time::createFromDate(); // Uses current year, month, and day
88+ $today = Time::createFromDate(); // Uses current year, month, and day
8989 $anniversary = Time::createFromDate(2018); // Uses current month and day
9090 $date = Time::createFromDate(2018, 3, 15, 'America/Chicago', 'en_US');
9191
@@ -96,7 +96,7 @@ Like ``createFromDate()`` except it is only concerned with the **hours**, **minu
9696current day for the date portion of the Time instance. Accepts strings for the timezone and locale in the
9797fourth and fifth parameters::
9898
99- $lunch = Time::createFromTime(11, 30); // 11:30 am today
99+ $lunch = Time::createFromTime(11, 30); // 11:30 am today
100100 $dinner = Time::createFromTime(18, 00, 00); // 6:00 pm today
101101 $time = Time::createFromTime($hour, $minutes, $seconds, $timezone, $locale);
102102
@@ -234,37 +234,37 @@ The following basic getters exist::
234234
235235 $time = Time::parse('August 12, 2016 4:15:23pm');
236236
237- echo $time->getYear(); // 2016
238- echo $time->getMonth(); // 8
239- echo $time->getDay(); // 12
240- echo $time->getHour(); // 16
237+ echo $time->getYear(); // 2016
238+ echo $time->getMonth(); // 8
239+ echo $time->getDay(); // 12
240+ echo $time->getHour(); // 16
241241 echo $time->getMinute(); // 15
242242 echo $time->getSecond(); // 23
243243
244- echo $time->year; // 2016
245- echo $time->month; // 8
246- echo $time->day; // 12
247- echo $time->hour; // 16
244+ echo $time->year; // 2016
245+ echo $time->month; // 8
246+ echo $time->day; // 12
247+ echo $time->hour; // 16
248248 echo $time->minute; // 15
249249 echo $time->second; // 23
250250
251251In addition to these, a number of methods exist to provide additional information about the date::
252252
253253 $time = Time::parse('August 12, 2016 4:15:23pm');
254254
255- echo $time->getDayOfWeek(); // 6 - but may vary based on locale's starting day of the week
256- echo $time->getDayOfYear(); // 225
255+ echo $time->getDayOfWeek(); // 6 - but may vary based on locale's starting day of the week
256+ echo $time->getDayOfYear(); // 225
257257 echo $time->getWeekOfMonth(); // 2
258- echo $time->getWeekOfYear(); // 33
259- echo $time->getTimestamp(); // 1471018523 - UNIX timestamp
260- echo $time->getQuarter(); // 3
258+ echo $time->getWeekOfYear(); // 33
259+ echo $time->getTimestamp(); // 1471018523 - UNIX timestamp
260+ echo $time->getQuarter(); // 3
261261
262- echo $time->dayOfWeek; // 6
263- echo $time->dayOfYear; // 225
262+ echo $time->dayOfWeek; // 6
263+ echo $time->dayOfYear; // 225
264264 echo $time->weekOfMonth; // 2
265- echo $time->weekOfYear; // 33
266- echo $time->timestamp; // 1471018523
267- echo $time->quarter; // 3
265+ echo $time->weekOfYear; // 33
266+ echo $time->timestamp; // 1471018523
267+ echo $time->quarter; // 3
268268
269269getAge()
270270--------
@@ -275,22 +275,22 @@ the age of someone based on their birthday::
275275 $time = Time::parse('5 years ago');
276276
277277 echo $time->getAge(); // 5
278- echo $time->age; // 5
278+ echo $time->age; // 5
279279
280280getDST()
281281--------
282282
283283Returns boolean true/false based on whether the Time instance is currently observing Daylight Savings Time::
284284
285285 echo Time::createFromDate(2012, 1, 1)->getDst(); // false
286- echo Time::createFromDate(2012, 9, 1)->dst; // true
286+ echo Time::createFromDate(2012, 9, 1)->dst; // true
287287
288288getLocal()
289289----------
290290
291291Returns boolean true if the Time instance is in the same timezone as the application is currently running in::
292292
293- echo Time::now()->getLocal(); // true
293+ echo Time::now()->getLocal(); // true
294294 echo Time::now('Europe/London'); // false
295295
296296getUtc()
@@ -299,7 +299,7 @@ getUtc()
299299Returns boolean true if the Time instance is in UTC time::
300300
301301 echo Time::now('America/Chicago')->getUtc(); // false
302- echo Time::now('UTC')->utc; // true
302+ echo Time::now('UTC')->utc; // true
303303
304304getTimezone()
305305-------------
@@ -319,7 +319,7 @@ getTimezoneName()
319319Returns the full `timezone string <https://www.php.net/manual/en/timezones.php >`__ of the Time instance::
320320
321321 echo Time::now('America/Chicago')->getTimezoneName(); // America/Chicago
322- echo Time::now('Europe/London')->timezoneName; // Europe/London
322+ echo Time::now('Europe/London')->timezoneName; // Europe/London
323323
324324Setters
325325=======
@@ -334,11 +334,11 @@ thrown.
334334::
335335
336336 $time = $time->setYear(2017);
337- $time = $time->setMonth(4); // April
337+ $time = $time->setMonth(4); // April
338338 $time = $time->setMonth('April');
339- $time = $time->setMonth('Feb'); // February
339+ $time = $time->setMonth('Feb'); // February
340340 $time = $time->setDay(25);
341- $time = $time->setHour(14); // 2:00 pm
341+ $time = $time->setHour(14); // 2:00 pm
342342 $time = $time->setMinute(30);
343343 $time = $time->setSecond(54);
344344
@@ -350,10 +350,10 @@ Converts the time from it's current timezone into the new one::
350350 $time = Time::parse('13 May 2020 10:00', 'America/Chicago');
351351 $time2 = $time->setTimezone('Europe/London'); // Returns new instance converted to new timezone
352352
353- echo $time->getTimezoneName(); // American/Chicago
353+ echo $time->getTimezoneName(); // American/Chicago
354354 echo $time2->getTimezoneName(); // Europe/London
355355
356- echo $time->toDateTimeString(); // 2020-05-13 10:00:00
356+ echo $time->toDateTimeString(); // 2020-05-13 10:00:00
357357 echo $time2->toDateTimeString(); // 2020-05-13 18:00:00
358358
359359setTimestamp()
@@ -364,7 +364,7 @@ Returns a new instance with the date set to the new timestamp::
364364 $time = Time::parse('May 10, 2017', 'America/Chicago');
365365 $time2 = $time->setTimestamp(strtotime('April 1, 2017'));
366366
367- echo $time->toDateTimeString(); // 2017-05-10 00:00:00
367+ echo $time->toDateTimeString(); // 2017-05-10 00:00:00
368368 echo $time2->toDateTimeString(); // 2017-04-01 00:00:00
369369
370370Modifying the Value
@@ -422,7 +422,7 @@ all identical::
422422 $time1 = Time::parse('January 10, 2017 21:50:00', 'America/Chicago');
423423 $time2 = Time::parse('January 11, 2017 03:50:00', 'Europe/London');
424424
425- $time1->sameAs($time2); // false
425+ $time1->sameAs($time2); // false
426426 $time2->sameAs('January 10, 2017 21:50:00', 'America/Chicago'); // true
427427
428428isBefore()
@@ -476,21 +476,21 @@ the original time::
476476
477477 $diff = $current->difference($test);
478478
479- echo $diff->getYears(); // -7
480- echo $diff->getMonths(); // -84
481- echo $diff->getWeeks(); // -365
482- echo $diff->getDays(); // -2557
483- echo $diff->getHours(); // -61368
479+ echo $diff->getYears(); // -7
480+ echo $diff->getMonths(); // -84
481+ echo $diff->getWeeks(); // -365
482+ echo $diff->getDays(); // -2557
483+ echo $diff->getHours(); // -61368
484484 echo $diff->getMinutes(); // -3682080
485485 echo $diff->getSeconds(); // -220924800
486486
487487You can use either ``getX() `` methods, or access the calculate values as if they were properties::
488488
489489 echo $diff->years; // -7
490- echo $diff->months; // -84
491- echo $diff->weeks; // -365
492- echo $diff->days; // -2557
493- echo $diff->hours; // -61368
490+ echo $diff->months; // -84
491+ echo $diff->weeks; // -365
492+ echo $diff->days; // -2557
493+ echo $diff->hours; // -61368
494494 echo $diff->minutes; // -3682080
495495 echo $diff->seconds; // -220924800
496496
0 commit comments