Skip to content

Commit

Permalink
Merge pull request #3119 from briannesbitt/job/update-documentation
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
kylekatarnls authored Dec 11, 2024
2 parents 5ff997b + f0c8296 commit 8e94ec3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
44 changes: 22 additions & 22 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ <h1 id="api-instantiation">Instantiation</h1>

<p>
<pre class="live-editor"><code class="php">$now = Carbon::now();
echo $now; // 2024-12-11 10:01:45
echo $now; // 2024-12-11 13:39:21
echo "\n";
$today = Carbon::today();
echo $today; // 2024-12-11 00:00:00
Expand Down Expand Up @@ -451,7 +451,7 @@ <h1 id="api-instantiation">Instantiation</h1>
// 19:15 in Johannesburg
echo 'Meeting starts at '.$meeting->format('H:i').' in Johannesburg.'; // Meeting starts at 19:15 in Johannesburg.
// now in Johannesburg
echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 12:01 right now in Johannesburg.
echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 15:39 right now in Johannesburg.
</code></pre>
</p>

Expand Down Expand Up @@ -705,7 +705,7 @@ <h1 id="api-localization">Localization</h1>
echo "\n";
echo $date->monthName; // décembre
echo "\n";
echo $date->isoFormat('LLLL'); // mercredi 11 décembre 2024 10:01
echo $date->isoFormat('LLLL'); // mercredi 11 décembre 2024 13:39
</code></pre>
</p>

Expand Down Expand Up @@ -736,13 +736,13 @@ <h1 id="api-localization">Localization</h1>
echo $toDisplay;
/*
15 juin 2018 14:34
Aujourd’hui à 11:01
Aujourd’hui à 14:39
*/

echo $notificationForJohn;
/*
Jun 15, 2018 7:34 AM
Today at 4:01 AM
Today at 7:39 AM
*/
</code></pre>
</p>
Expand Down Expand Up @@ -1654,21 +1654,21 @@ <h1 id="api-localization">Localization</h1>

<p>
<pre class="live-editor"><code class="php">$date = CarbonImmutable::now();
echo $date->calendar(); // Today at 10:01 AM
echo $date->calendar(); // Today at 1:39 PM
echo "\n";
echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 7:01 AM
echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 10:39 AM
echo "\n";
echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Saturday at 11:38 PM
echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Sunday at 3:16 AM
echo "\n";
echo $date->sub('8 days')->calendar(); // 12/03/2024
echo "\n";
echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 1:01 PM
echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 4:39 PM
echo "\n";
echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Saturday at 8:24 PM
echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Sunday at 12:02 AM
echo "\n";
echo $date->add('8 days')->calendar(); // 12/19/2024
echo "\n";
echo $date->locale('fr')->calendar(); // Aujourd’hui à 10:01
echo $date->locale('fr')->calendar(); // Aujourd’hui à 13:39
</code></pre>
</p>

Expand Down Expand Up @@ -5588,7 +5588,7 @@ <h1 id="api-testing">Testing Aids</h1>
var_dump(Carbon::hasTestNow()); // bool(true)
Carbon::setTestNow(); // clear the mock
var_dump(Carbon::hasTestNow()); // bool(false)
echo Carbon::now(); // 2024-12-11 10:01:46
echo Carbon::now(); // 2024-12-11 13:39:21
// Instead of mock and clear mock, you also can use withTestNow():

Carbon::withTestNow('2010-09-15', static function () {
Expand Down Expand Up @@ -5831,12 +5831,12 @@ <h1 id="api-getters">Getters</h1>

// You can get any property dynamically too:
$unit = 'second';
var_dump(Carbon::now()->get($unit)); // int(46)
var_dump(Carbon::now()->get($unit)); // int(21)
// equivalent to:
var_dump(Carbon::now()->$unit); // int(46)
var_dump(Carbon::now()->$unit); // int(21)
// If you have plural unit name, use singularUnit()
$unit = Carbon::singularUnit('seconds');
var_dump(Carbon::now()->get($unit)); // int(46)
var_dump(Carbon::now()->get($unit)); // int(21)
// Prefer using singularUnit() because some plurals are not the word with S:
var_dump(Carbon::pluralUnit('century')); // string(9) "centuries"
var_dump(Carbon::pluralUnit('millennium')); // string(9) "millennia"
Expand Down Expand Up @@ -6413,8 +6413,8 @@ <h1 id="api-comparison">Comparison</h1>

// now is the default param
$dt1 = Carbon::createMidnightDate(2000, 1, 1);
echo $dt1->max(); // 2024-12-11 10:01:46
echo $dt1->maximum(); // 2024-12-11 10:01:46
echo $dt1->max(); // 2024-12-11 13:39:21
echo $dt1->maximum(); // 2024-12-11 13:39:21

// Remember min and max PHP native function work fine with dates too:
echo max(Carbon::create('2002-03-15'), Carbon::create('2003-01-07'), Carbon::create('2002-08-25')); // 2003-01-07 00:00:00
Expand Down Expand Up @@ -7048,10 +7048,10 @@ <h1 id="api-difference">Difference</h1>

$date = Carbon::now()->addSeconds(3666);

echo $date->diffInSeconds(); // -3665.999952
echo $date->diffInMinutes(); // -61.0999984
echo $date->diffInHours(); // -1.0183332958333
echo $date->diffInDays(); // -0.042430553587963
echo $date->diffInSeconds(); // -3665.999953
echo $date->diffInMinutes(); // -61.0999985
echo $date->diffInHours(); // -1.0183332983333
echo $date->diffInDays(); // -0.04243055369213

$date = Carbon::create(2016, 1, 5, 22, 40, 32);

Expand Down Expand Up @@ -7706,7 +7706,7 @@ <h1 id="api-macro">Macro</h1>
echo "\n";
echo Carbon::tomorrow()->formatForUser(); // Demain à 01:00
echo "\n";
echo Carbon::now()->subDays(3)->formatForUser(); // dimanche dernier à 11:01
echo Carbon::now()->subDays(3)->formatForUser(); // dimanche dernier à 14:39
</code></pre>
</p>

Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ <h2 id="sponsors">Sponsors</h2>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid #7ac35f; background: white;" title="Trusted last mile route planning and route optimization" href="https://route4me.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Route4Me Route Planner" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/237386c3-48a2-47c6-97ac-5f888cdb4cda/Route4MeIconLogo.png" width="64" height="64"><span style="position: absolute; top: -15px; right: -15px; text-shadow: 0 0 3px black;"></span></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid #7ac35f; background: white;" title="Онлайн казино та БК (ставки на спорт) в Україні" href="https://betking.com.ua/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Betking" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/08587758-582c-4136-aba5-2519230960d3/betking.jpg" width="64" height="64"><span style="position: absolute; top: -15px; right: -15px; text-shadow: 0 0 3px black;"></span></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid #7ac35f; background: white;" title="Ставки на спорт, БК в Україні" href="https://betking.com.ua/sports-book/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Букмекер" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/065e61d2-f890-42db-b06c-8d40b39b2f0e/bk.jpg" width="64" height="64"><span style="position: absolute; top: -15px; right: -15px; text-shadow: 0 0 3px black;"></span></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid #7ac35f; background: white;" title="Нова українська букмекерська контора" href="https://betking.com.ua/sports-book/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Ставки на спорт" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c56d2fe2-f9fb-4d63-947c-77575f4b15c6/stavki.jpg" width="64" height="64"><span style="position: absolute; top: -15px; right: -15px; text-shadow: 0 0 3px black;"></span></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid #7ac35f; background: white;" title="Znajdź najlepsze zakłady bukmacherskie w Polsce w 2023 roku. Probukmacher.pl to Twoje kompendium wiedzy na temat bukmacherów!" href="https://www.probukmacher.pl?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Probukmacher" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/caf50271-4560-4ffe-a434-ea15239168db/Screenshot_1.png" width="89" height="64"><span style="position: absolute; top: -15px; right: -15px; text-shadow: 0 0 3px black;"></span></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="inkedin" href="https://inkedin.com?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="inkedin" src="https://logo.clearbit.com/inkedin.com" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="Актуальний та повносправний рейтинг онлайн казино України, ґрунтований на відгуках реальних гравців." href="https://uk.onlinecasino.in.ua/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Онлайн казино України" src="https://opencollective-production.s3.us-west-1.amazonaws.com/c0b4b090-eef8-11ec-9cb7-0527a205b226.png" width="64" height="64"></a>
Expand Down Expand Up @@ -287,8 +288,8 @@ <h2 id="backers">Backers</h2>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Tomba, your unique B2B email finder and verifier, provides a distinctive lead database for effortless and effective outreach scaling.
" href="https://tomba.io/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Tomba.io" src="https://logo.clearbit.com/tomba.io" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Ausmalbilder zum Ausdrucken" href="https://www.on7g.de/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="ON7G" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cc2443c3-5799-4070-92a0-734607f1c625/onyedi.jpg" width="32" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Hitta rabattkod" href="https://hittarabattkod.nu/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Hitta rabattkod" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c9bba148-dad3-43c9-88b9-1a36f4a58bb7/android-chrome-512x512.png" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Jämför försäkringar" href="https://jamforforsakringar.se/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Jämför försäkringar" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/dbbd945f-1098-40f7-8b3e-0bf3b969869c/android-chrome-512x512.jpg" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Hitta rabattkod" href="https://hittarabattkod.nu/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Hitta rabattkod" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c9bba148-dad3-43c9-88b9-1a36f4a58bb7/android-chrome-512x512.png" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="meilleur jeux casino en ligne" href="https://bsc.news/post/meilleur-casino-en-ligne-fiable?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="meilleur jeux casino en ligne" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ad8a1e55-a922-46b8-b69d-21b2769f7a70/casino%20en%20ligne%20france.png" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Twitter Video Downloader HD Tool allows you to store tweets on your device (mobile or PC) for free." href="https://ssstwitter.online/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="SSSTwitter" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ba0d1daf-a894-4d98-95f7-a44d321364b3/Screenshot%202024-01-16%20at%2011.43.22.png" width="29" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Triplebyte is the first software engineering job platform that is on the developer&#039;s side. Take our coding quiz!" href="https://triplebyte.com/os/opencollective?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Triplebyte" src="https://opencollective-production.s3.us-west-1.amazonaws.com/43e4f9d0-30cd-11ea-9c6b-e1142996e8b2.png" width="24" height="24"></a>
Expand Down

0 comments on commit 8e94ec3

Please sign in to comment.