From 2ecd19e3b61fc1bcd8f237da049d745a13bc7716 Mon Sep 17 00:00:00 2001
From: kylekatarnls
Introduction
$modifiedImmutable = CarbonImmutable::now()->add(1, 'day');
var_dump($modifiedMutable === $mutable); // bool(true)
-var_dump($mutable->isoFormat('dddd D')); // string(12) "Wednesday 25"
-var_dump($modifiedMutable->isoFormat('dddd D')); // string(12) "Wednesday 25"
+var_dump($mutable->isoFormat('dddd D')); // string(11) "Thursday 10"
+var_dump($modifiedMutable->isoFormat('dddd D')); // string(11) "Thursday 10"
// So it means $mutable and $modifiedMutable are the same object
// both set to now + 1 day.
var_dump($modifiedImmutable === $immutable); // bool(false)
-var_dump($immutable->isoFormat('dddd D')); // string(10) "Tuesday 24"
-var_dump($modifiedImmutable->isoFormat('dddd D')); // string(12) "Wednesday 25"
+var_dump($immutable->isoFormat('dddd D')); // string(11) "Wednesday 9"
+var_dump($modifiedImmutable->isoFormat('dddd D')); // string(11) "Thursday 10"
// While $immutable is still set to now and cannot be changed and
// $modifiedImmutable is a new instance created from $immutable
// set to now + 1 day.
@@ -281,16 +281,16 @@ Instantiation
$now = Carbon::now();
-echo $now; // 2024-09-24 09:21:00
+echo $now; // 2024-10-09 22:29:15
echo "\n";
$today = Carbon::today();
-echo $today; // 2024-09-24 00:00:00
+echo $today; // 2024-10-09 00:00:00
echo "\n";
$tomorrow = Carbon::tomorrow('Europe/London');
-echo $tomorrow; // 2024-09-25 00:00:00
+echo $tomorrow; // 2024-10-10 00:00:00
echo "\n";
$yesterday = Carbon::yesterday();
-echo $yesterday; // 2024-09-23 00:00:00
+echo $yesterday; // 2024-10-08 00:00:00
$date = CarbonImmutable::now();
-echo $date->calendar(); // Today at 9:21 AM
+echo $date->calendar(); // Today at 10:29 PM
echo "\n";
-echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 6:21 AM
+echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 7:29 PM
echo "\n";
-echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Friday at 10:58 PM
+echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Sunday at 12:06 PM
echo "\n";
-echo $date->sub('8 days')->calendar(); // 09/16/2024
+echo $date->sub('8 days')->calendar(); // 10/01/2024
echo "\n";
-echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 12:21 PM
+echo $date->add('1 day 3 hours')->calendar(); // Friday at 1:29 AM
echo "\n";
-echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Friday at 7:44 PM
+echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Sunday at 8:52 AM
echo "\n";
-echo $date->add('8 days')->calendar(); // 10/02/2024
+echo $date->add('8 days')->calendar(); // 10/17/2024
echo "\n";
-echo $date->locale('fr')->calendar(); // Aujourd’hui à 09:21
+echo $date->locale('fr')->calendar(); // Aujourd’hui à 22:29
@@ -5588,7 +5588,7 @@ -
echo Carbon::now('America/Vancouver')->diffInSeconds(Carbon::now('Europe/London')); // 1.0E-5
+ echo Carbon::now('America/Vancouver')->diffInSeconds(Carbon::now('Europe/London')); // 9.0E-6
$dtOttawa = Carbon::createMidnightDate(2000, 1, 1, 'America/Toronto');
$dtVancouver = Carbon::createMidnightDate(2000, 1, 1, 'America/Vancouver');
@@ -7048,10 +7048,10 @@ Difference
$date = Carbon::now()->addSeconds(3666);
-echo $date->diffInSeconds(); // -3665.999871
-echo $date->diffInMinutes(); // -61.0999962
-echo $date->diffInHours(); // -1.0183332469444
-echo $date->diffInDays(); // -0.042430551006944
+echo $date->diffInSeconds(); // -3665.99991
+echo $date->diffInMinutes(); // -61.0999969
+echo $date->diffInHours(); // -1.0183332591667
+echo $date->diffInDays(); // -0.042430551574074
$date = Carbon::create(2016, 1, 5, 22, 40, 32);
@@ -7704,9 +7704,9 @@ Macro
// Then now you can easily display any date in a page/e-mail using those user settings and the chosen format
echo Carbon::parse($dateString, 'UTC')->formatForUser(); // 23/01/2010
echo "\n";
-echo Carbon::tomorrow()->formatForUser(); // Demain à 02:00
+echo Carbon::tomorrow()->formatForUser(); // Aujourd’hui à 02:00
echo "\n";
-echo Carbon::now()->subDays(3)->formatForUser(); // samedi dernier à 11:21
+echo Carbon::now()->subDays(3)->formatForUser(); // lundi dernier à 00:29
@@ -7969,10 +7969,10 @@ Macro
echo substr(implode(', ', $dates), 0, 100).'...';
}
-dumpDateList(Carbon::getCurrentWeekDays()); // 2024-09-23 00:00:00, 2024-09-24 00:00:00, 2024-09-25 00:00:00, 2024-09-26 00:00:00, 2024-09-27 00:00...
-dumpDateList(Carbon::getCurrentMonthDays()); // 2024-09-01 00:00:00, 2024-09-02 00:00:00, 2024-09-03 00:00:00, 2024-09-04 00:00:00, 2024-09-05 00:00...
-dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2024-08-19 00:00:00, 2024-08-20 00:00:00, 2024-08-21 00:00:00, 2024-08-22 00:00:00, 2024-08-23 00:00...
-dumpDateList(Carbon::now()->subMonth()->getCurrentMonthDays()); // 2024-08-01 00:00:00, 2024-08-02 00:00:00, 2024-08-03 00:00:00, 2024-08-04 00:00:00, 2024-08-05 00:00...
+dumpDateList(Carbon::getCurrentWeekDays()); // 2024-10-07 00:00:00, 2024-10-08 00:00:00, 2024-10-09 00:00:00, 2024-10-10 00:00:00, 2024-10-11 00:00...
+dumpDateList(Carbon::getCurrentMonthDays()); // 2024-10-01 00:00:00, 2024-10-02 00:00:00, 2024-10-03 00:00:00, 2024-10-04 00:00:00, 2024-10-05 00:00...
+dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2024-09-09 00:00:00, 2024-09-10 00:00:00, 2024-09-11 00:00:00, 2024-09-12 00:00:00, 2024-09-13 00:00...
+dumpDateList(Carbon::now()->subMonth()->getCurrentMonthDays()); // 2024-09-01 00:00:00, 2024-09-02 00:00:00, 2024-09-03 00:00:00, 2024-09-04 00:00:00, 2024-09-05 00:00...
@@ -8951,7 +8951,7 @@