Debian Codegraph @

lib/3rdParty/composer/nesbot/carbon/src/Carbon/CarbonInterface.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * This file is part of the Carbon package.
7 *
8 * (c) Brian Nesbitt <[email protected]>
9 *
10 * For the full copyright and license information, please view the LICENSE
11 * file that was distributed with this source code.
12 */
13
14 namespace Carbon;
15
16 use BadMethodCallException;
17 use Carbon\Constants\DiffOptions;
18 use Carbon\Constants\Format;
19 use Carbon\Constants\TranslationOptions;
20 use Carbon\Constants\UnitValue;
21 use Carbon\Exceptions\BadComparisonUnitException;
22 use Carbon\Exceptions\ImmutableException;
23 use Carbon\Exceptions\InvalidDateException;
24 use Carbon\Exceptions\InvalidFormatException;
25 use Carbon\Exceptions\UnknownGetterException;
26 use Carbon\Exceptions\UnknownMethodException;
27 use Carbon\Exceptions\UnknownSetterException;
28 use Closure;
29 use DateInterval;
30 use DateTime;
31 use DateTimeImmutable;
32 use DateTimeInterface;
33 use DateTimeZone;
34 use JsonSerializable;
35 use ReflectionException;
36 use ReturnTypeWillChange;
37 use Symfony\Contracts\Translation\TranslatorInterface;
38 use Throwable;
39
40 /**
41 * Common interface for Carbon and CarbonImmutable.
42 *
43 * <autodoc generated by `composer phpdoc`>
44 *
45 * @property string $localeDayOfWeek the day of week in current locale
46 * @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale
47 * @property string $localeMonth the month in current locale
48 * @property string $shortLocaleMonth the abbreviated month in current locale
49 * @property int $year
50 * @property int $yearIso
51 * @property int $month
52 * @property int $day
53 * @property int $hour
54 * @property int $minute
55 * @property int $second
56 * @property int $micro
57 * @property int $microsecond
58 * @property int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday)
59 * @property int|float|string $timestamp seconds since the Unix Epoch
60 * @property string $englishDayOfWeek the day of week in English
61 * @property string $shortEnglishDayOfWeek the abbreviated day of week in English
62 * @property string $englishMonth the month in English
63 * @property string $shortEnglishMonth the abbreviated month in English
64 * @property int $milliseconds
65 * @property int $millisecond
66 * @property int $milli
67 * @property int $week 1 through 53
68 * @property int $isoWeek 1 through 53
69 * @property int $weekYear year according to week format
70 * @property int $isoWeekYear year according to ISO week format
71 * @property int $age does a diffInYears() with default parameters
72 * @property int $offset the timezone offset in seconds from UTC
73 * @property int $offsetMinutes the timezone offset in minutes from UTC
74 * @property int $offsetHours the timezone offset in hours from UTC
75 * @property CarbonTimeZone $timezone the current timezone
76 * @property CarbonTimeZone $tz alias of $timezone
77 * @property int $centuryOfMillennium The value of the century starting from the beginning of the current millennium
78 * @property int $dayOfCentury The value of the day starting from the beginning of the current century
79 * @property int $dayOfDecade The value of the day starting from the beginning of the current decade
80 * @property int $dayOfMillennium The value of the day starting from the beginning of the current millennium
81 * @property int $dayOfMonth The value of the day starting from the beginning of the current month
82 * @property int $dayOfQuarter The value of the day starting from the beginning of the current quarter
83 * @property int $dayOfWeek 0 (for Sunday) through 6 (for Saturday)
84 * @property int $dayOfYear 1 through 366
85 * @property int $decadeOfCentury The value of the decade starting from the beginning of the current century
86 * @property int $decadeOfMillennium The value of the decade starting from the beginning of the current millennium
87 * @property int $hourOfCentury The value of the hour starting from the beginning of the current century
88 * @property int $hourOfDay The value of the hour starting from the beginning of the current day
89 * @property int $hourOfDecade The value of the hour starting from the beginning of the current decade
90 * @property int $hourOfMillennium The value of the hour starting from the beginning of the current millennium
91 * @property int $hourOfMonth The value of the hour starting from the beginning of the current month
92 * @property int $hourOfQuarter The value of the hour starting from the beginning of the current quarter
93 * @property int $hourOfWeek The value of the hour starting from the beginning of the current week
94 * @property int $hourOfYear The value of the hour starting from the beginning of the current year
95 * @property int $microsecondOfCentury The value of the microsecond starting from the beginning of the current century
96 * @property int $microsecondOfDay The value of the microsecond starting from the beginning of the current day
97 * @property int $microsecondOfDecade The value of the microsecond starting from the beginning of the current decade
98 * @property int $microsecondOfHour The value of the microsecond starting from the beginning of the current hour
99 * @property int $microsecondOfMillennium The value of the microsecond starting from the beginning of the current millennium
100 * @property int $microsecondOfMillisecond The value of the microsecond starting from the beginning of the current millisecond
101 * @property int $microsecondOfMinute The value of the microsecond starting from the beginning of the current minute
102 * @property int $microsecondOfMonth The value of the microsecond starting from the beginning of the current month
103 * @property int $microsecondOfQuarter The value of the microsecond starting from the beginning of the current quarter
104 * @property int $microsecondOfSecond The value of the microsecond starting from the beginning of the current second
105 * @property int $microsecondOfWeek The value of the microsecond starting from the beginning of the current week
106 * @property int $microsecondOfYear The value of the microsecond starting from the beginning of the current year
107 * @property int $millisecondOfCentury The value of the millisecond starting from the beginning of the current century
108 * @property int $millisecondOfDay The value of the millisecond starting from the beginning of the current day
109 * @property int $millisecondOfDecade The value of the millisecond starting from the beginning of the current decade
110 * @property int $millisecondOfHour The value of the millisecond starting from the beginning of the current hour
111 * @property int $millisecondOfMillennium The value of the millisecond starting from the beginning of the current millennium
112 * @property int $millisecondOfMinute The value of the millisecond starting from the beginning of the current minute
113 * @property int $millisecondOfMonth The value of the millisecond starting from the beginning of the current month
114 * @property int $millisecondOfQuarter The value of the millisecond starting from the beginning of the current quarter
115 * @property int $millisecondOfSecond The value of the millisecond starting from the beginning of the current second
116 * @property int $millisecondOfWeek The value of the millisecond starting from the beginning of the current week
117 * @property int $millisecondOfYear The value of the millisecond starting from the beginning of the current year
118 * @property int $minuteOfCentury The value of the minute starting from the beginning of the current century
119 * @property int $minuteOfDay The value of the minute starting from the beginning of the current day
120 * @property int $minuteOfDecade The value of the minute starting from the beginning of the current decade
121 * @property int $minuteOfHour The value of the minute starting from the beginning of the current hour
122 * @property int $minuteOfMillennium The value of the minute starting from the beginning of the current millennium
123 * @property int $minuteOfMonth The value of the minute starting from the beginning of the current month
124 * @property int $minuteOfQuarter The value of the minute starting from the beginning of the current quarter
125 * @property int $minuteOfWeek The value of the minute starting from the beginning of the current week
126 * @property int $minuteOfYear The value of the minute starting from the beginning of the current year
127 * @property int $monthOfCentury The value of the month starting from the beginning of the current century
128 * @property int $monthOfDecade The value of the month starting from the beginning of the current decade
129 * @property int $monthOfMillennium The value of the month starting from the beginning of the current millennium
130 * @property int $monthOfQuarter The value of the month starting from the beginning of the current quarter
131 * @property int $monthOfYear The value of the month starting from the beginning of the current year
132 * @property int $quarterOfCentury The value of the quarter starting from the beginning of the current century
133 * @property int $quarterOfDecade The value of the quarter starting from the beginning of the current decade
134 * @property int $quarterOfMillennium The value of the quarter starting from the beginning of the current millennium
135 * @property int $quarterOfYear The value of the quarter starting from the beginning of the current year
136 * @property int $secondOfCentury The value of the second starting from the beginning of the current century
137 * @property int $secondOfDay The value of the second starting from the beginning of the current day
138 * @property int $secondOfDecade The value of the second starting from the beginning of the current decade
139 * @property int $secondOfHour The value of the second starting from the beginning of the current hour
140 * @property int $secondOfMillennium The value of the second starting from the beginning of the current millennium
141 * @property int $secondOfMinute The value of the second starting from the beginning of the current minute
142 * @property int $secondOfMonth The value of the second starting from the beginning of the current month
143 * @property int $secondOfQuarter The value of the second starting from the beginning of the current quarter
144 * @property int $secondOfWeek The value of the second starting from the beginning of the current week
145 * @property int $secondOfYear The value of the second starting from the beginning of the current year
146 * @property int $weekOfCentury The value of the week starting from the beginning of the current century
147 * @property int $weekOfDecade The value of the week starting from the beginning of the current decade
148 * @property int $weekOfMillennium The value of the week starting from the beginning of the current millennium
149 * @property int $weekOfMonth 1 through 5
150 * @property int $weekOfQuarter The value of the week starting from the beginning of the current quarter
151 * @property int $weekOfYear ISO-8601 week number of year, weeks starting on Monday
152 * @property int $yearOfCentury The value of the year starting from the beginning of the current century
153 * @property int $yearOfDecade The value of the year starting from the beginning of the current decade
154 * @property int $yearOfMillennium The value of the year starting from the beginning of the current millennium
155 * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark)
156 * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark)
157 * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name
158 * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName
159 * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language
160 * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language
161 * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language
162 * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language
163 * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language
164 * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
165 * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
166 * @property-read int $noZeroHour current hour from 1 to 24
167 * @property-read int $isoWeeksInYear 51 through 53
168 * @property-read int $weekNumberInMonth 1 through 5
169 * @property-read int $firstWeekDay 0 through 6
170 * @property-read int $lastWeekDay 0 through 6
171 * @property-read int $quarter the quarter of this instance, 1 - 4
172 * @property-read int $decade the decade of this instance
173 * @property-read int $century the century of this instance
174 * @property-read int $millennium the millennium of this instance
175 * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise
176 * @property-read bool $local checks if the timezone is local, true if local, false otherwise
177 * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise
178 * @property-read string $timezoneName the current timezone name
179 * @property-read string $tzName alias of $timezoneName
180 * @property-read string $locale locale of the current instance
181 * @property-read int $centuriesInMillennium The number of centuries contained in the current millennium
182 * @property-read int $daysInCentury The number of days contained in the current century
183 * @property-read int $daysInDecade The number of days contained in the current decade
184 * @property-read int $daysInMillennium The number of days contained in the current millennium
185 * @property-read int $daysInMonth number of days in the given month
186 * @property-read int $daysInQuarter The number of days contained in the current quarter
187 * @property-read int $daysInWeek The number of days contained in the current week
188 * @property-read int $daysInYear 365 or 366
189 * @property-read int $decadesInCentury The number of decades contained in the current century
190 * @property-read int $decadesInMillennium The number of decades contained in the current millennium
191 * @property-read int $hoursInCentury The number of hours contained in the current century
192 * @property-read int $hoursInDay The number of hours contained in the current day
193 * @property-read int $hoursInDecade The number of hours contained in the current decade
194 * @property-read int $hoursInMillennium The number of hours contained in the current millennium
195 * @property-read int $hoursInMonth The number of hours contained in the current month
196 * @property-read int $hoursInQuarter The number of hours contained in the current quarter
197 * @property-read int $hoursInWeek The number of hours contained in the current week
198 * @property-read int $hoursInYear The number of hours contained in the current year
199 * @property-read int $microsecondsInCentury The number of microseconds contained in the current century
200 * @property-read int $microsecondsInDay The number of microseconds contained in the current day
201 * @property-read int $microsecondsInDecade The number of microseconds contained in the current decade
202 * @property-read int $microsecondsInHour The number of microseconds contained in the current hour
203 * @property-read int $microsecondsInMillennium The number of microseconds contained in the current millennium
204 * @property-read int $microsecondsInMillisecond The number of microseconds contained in the current millisecond
205 * @property-read int $microsecondsInMinute The number of microseconds contained in the current minute
206 * @property-read int $microsecondsInMonth The number of microseconds contained in the current month
207 * @property-read int $microsecondsInQuarter The number of microseconds contained in the current quarter
208 * @property-read int $microsecondsInSecond The number of microseconds contained in the current second
209 * @property-read int $microsecondsInWeek The number of microseconds contained in the current week
210 * @property-read int $microsecondsInYear The number of microseconds contained in the current year
211 * @property-read int $millisecondsInCentury The number of milliseconds contained in the current century
212 * @property-read int $millisecondsInDay The number of milliseconds contained in the current day
213 * @property-read int $millisecondsInDecade The number of milliseconds contained in the current decade
214 * @property-read int $millisecondsInHour The number of milliseconds contained in the current hour
215 * @property-read int $millisecondsInMillennium The number of milliseconds contained in the current millennium
216 * @property-read int $millisecondsInMinute The number of milliseconds contained in the current minute
217 * @property-read int $millisecondsInMonth The number of milliseconds contained in the current month
218 * @property-read int $millisecondsInQuarter The number of milliseconds contained in the current quarter
219 * @property-read int $millisecondsInSecond The number of milliseconds contained in the current second
220 * @property-read int $millisecondsInWeek The number of milliseconds contained in the current week
221 * @property-read int $millisecondsInYear The number of milliseconds contained in the current year
222 * @property-read int $minutesInCentury The number of minutes contained in the current century
223 * @property-read int $minutesInDay The number of minutes contained in the current day
224 * @property-read int $minutesInDecade The number of minutes contained in the current decade
225 * @property-read int $minutesInHour The number of minutes contained in the current hour
226 * @property-read int $minutesInMillennium The number of minutes contained in the current millennium
227 * @property-read int $minutesInMonth The number of minutes contained in the current month
228 * @property-read int $minutesInQuarter The number of minutes contained in the current quarter
229 * @property-read int $minutesInWeek The number of minutes contained in the current week
230 * @property-read int $minutesInYear The number of minutes contained in the current year
231 * @property-read int $monthsInCentury The number of months contained in the current century
232 * @property-read int $monthsInDecade The number of months contained in the current decade
233 * @property-read int $monthsInMillennium The number of months contained in the current millennium
234 * @property-read int $monthsInQuarter The number of months contained in the current quarter
235 * @property-read int $monthsInYear The number of months contained in the current year
236 * @property-read int $quartersInCentury The number of quarters contained in the current century
237 * @property-read int $quartersInDecade The number of quarters contained in the current decade
238 * @property-read int $quartersInMillennium The number of quarters contained in the current millennium
239 * @property-read int $quartersInYear The number of quarters contained in the current year
240 * @property-read int $secondsInCentury The number of seconds contained in the current century
241 * @property-read int $secondsInDay The number of seconds contained in the current day
242 * @property-read int $secondsInDecade The number of seconds contained in the current decade
243 * @property-read int $secondsInHour The number of seconds contained in the current hour
244 * @property-read int $secondsInMillennium The number of seconds contained in the current millennium
245 * @property-read int $secondsInMinute The number of seconds contained in the current minute
246 * @property-read int $secondsInMonth The number of seconds contained in the current month
247 * @property-read int $secondsInQuarter The number of seconds contained in the current quarter
248 * @property-read int $secondsInWeek The number of seconds contained in the current week
249 * @property-read int $secondsInYear The number of seconds contained in the current year
250 * @property-read int $weeksInCentury The number of weeks contained in the current century
251 * @property-read int $weeksInDecade The number of weeks contained in the current decade
252 * @property-read int $weeksInMillennium The number of weeks contained in the current millennium
253 * @property-read int $weeksInMonth The number of weeks contained in the current month
254 * @property-read int $weeksInQuarter The number of weeks contained in the current quarter
255 * @property-read int $weeksInYear 51 through 53
256 * @property-read int $yearsInCentury The number of years contained in the current century
257 * @property-read int $yearsInDecade The number of years contained in the current decade
258 * @property-read int $yearsInMillennium The number of years contained in the current millennium
259 *
260 * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.)
261 * @method bool isLocal() Check if the current instance has non-UTC timezone.
262 * @method bool isValid() Check if the current instance is a valid date.
263 * @method bool isDST() Check if the current instance is in a daylight saving time.
264 * @method bool isSunday() Checks if the instance day is sunday.
265 * @method bool isMonday() Checks if the instance day is monday.
266 * @method bool isTuesday() Checks if the instance day is tuesday.
267 * @method bool isWednesday() Checks if the instance day is wednesday.
268 * @method bool isThursday() Checks if the instance day is thursday.
269 * @method bool isFriday() Checks if the instance day is friday.
270 * @method bool isSaturday() Checks if the instance day is saturday.
271 * @method bool isSameYear(DateTimeInterface|string $date) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone).
272 * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment.
273 * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year.
274 * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year.
275 * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment.
276 * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month.
277 * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month.
278 * @method bool isSameWeek(DateTimeInterface|string $date) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone).
279 * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment.
280 * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week.
281 * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week.
282 * @method bool isSameDay(DateTimeInterface|string $date) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone).
283 * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment.
284 * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day.
285 * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day.
286 * @method bool isSameHour(DateTimeInterface|string $date) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone).
287 * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment.
288 * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour.
289 * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour.
290 * @method bool isSameMinute(DateTimeInterface|string $date) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone).
291 * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment.
292 * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute.
293 * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute.
294 * @method bool isSameSecond(DateTimeInterface|string $date) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone).
295 * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment.
296 * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second.
297 * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second.
298 * @method bool isSameMilli(DateTimeInterface|string $date) Checks if the given date is in the same millisecond as the instance. If null passed, compare to now (with the same timezone).
299 * @method bool isCurrentMilli() Checks if the instance is in the same millisecond as the current moment.
300 * @method bool isNextMilli() Checks if the instance is in the same millisecond as the current moment next millisecond.
301 * @method bool isLastMilli() Checks if the instance is in the same millisecond as the current moment last millisecond.
302 * @method bool isSameMillisecond(DateTimeInterface|string $date) Checks if the given date is in the same millisecond as the instance. If null passed, compare to now (with the same timezone).
303 * @method bool isCurrentMillisecond() Checks if the instance is in the same millisecond as the current moment.
304 * @method bool isNextMillisecond() Checks if the instance is in the same millisecond as the current moment next millisecond.
305 * @method bool isLastMillisecond() Checks if the instance is in the same millisecond as the current moment last millisecond.
306 * @method bool isSameMicro(DateTimeInterface|string $date) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
307 * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment.
308 * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond.
309 * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond.
310 * @method bool isSameMicrosecond(DateTimeInterface|string $date) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
311 * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment.
312 * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond.
313 * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond.
314 * @method bool isSameDecade(DateTimeInterface|string $date) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone).
315 * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment.
316 * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade.
317 * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade.
318 * @method bool isSameCentury(DateTimeInterface|string $date) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone).
319 * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment.
320 * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century.
321 * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century.
322 * @method bool isSameMillennium(DateTimeInterface|string $date) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone).
323 * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment.
324 * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium.
325 * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium.
326 * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment.
327 * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter.
328 * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter.
329 * @method CarbonInterface years(int $value) Set current instance year to the given value.
330 * @method CarbonInterface year(int $value) Set current instance year to the given value.
331 * @method CarbonInterface setYears(int $value) Set current instance year to the given value.
332 * @method CarbonInterface setYear(int $value) Set current instance year to the given value.
333 * @method CarbonInterface months(Month|int $value) Set current instance month to the given value.
334 * @method CarbonInterface month(Month|int $value) Set current instance month to the given value.
335 * @method CarbonInterface setMonths(Month|int $value) Set current instance month to the given value.
336 * @method CarbonInterface setMonth(Month|int $value) Set current instance month to the given value.
337 * @method CarbonInterface days(int $value) Set current instance day to the given value.
338 * @method CarbonInterface day(int $value) Set current instance day to the given value.
339 * @method CarbonInterface setDays(int $value) Set current instance day to the given value.
340 * @method CarbonInterface setDay(int $value) Set current instance day to the given value.
341 * @method CarbonInterface hours(int $value) Set current instance hour to the given value.
342 * @method CarbonInterface hour(int $value) Set current instance hour to the given value.
343 * @method CarbonInterface setHours(int $value) Set current instance hour to the given value.
344 * @method CarbonInterface setHour(int $value) Set current instance hour to the given value.
345 * @method CarbonInterface minutes(int $value) Set current instance minute to the given value.
346 * @method CarbonInterface minute(int $value) Set current instance minute to the given value.
347 * @method CarbonInterface setMinutes(int $value) Set current instance minute to the given value.
348 * @method CarbonInterface setMinute(int $value) Set current instance minute to the given value.
349 * @method CarbonInterface seconds(int $value) Set current instance second to the given value.
350 * @method CarbonInterface second(int $value) Set current instance second to the given value.
351 * @method CarbonInterface setSeconds(int $value) Set current instance second to the given value.
352 * @method CarbonInterface setSecond(int $value) Set current instance second to the given value.
353 * @method CarbonInterface millis(int $value) Set current instance millisecond to the given value.
354 * @method CarbonInterface milli(int $value) Set current instance millisecond to the given value.
355 * @method CarbonInterface setMillis(int $value) Set current instance millisecond to the given value.
356 * @method CarbonInterface setMilli(int $value) Set current instance millisecond to the given value.
357 * @method CarbonInterface milliseconds(int $value) Set current instance millisecond to the given value.
358 * @method CarbonInterface millisecond(int $value) Set current instance millisecond to the given value.
359 * @method CarbonInterface setMilliseconds(int $value) Set current instance millisecond to the given value.
360 * @method CarbonInterface setMillisecond(int $value) Set current instance millisecond to the given value.
361 * @method CarbonInterface micros(int $value) Set current instance microsecond to the given value.
362 * @method CarbonInterface micro(int $value) Set current instance microsecond to the given value.
363 * @method CarbonInterface setMicros(int $value) Set current instance microsecond to the given value.
364 * @method CarbonInterface setMicro(int $value) Set current instance microsecond to the given value.
365 * @method CarbonInterface microseconds(int $value) Set current instance microsecond to the given value.
366 * @method CarbonInterface microsecond(int $value) Set current instance microsecond to the given value.
367 * @method CarbonInterface setMicroseconds(int $value) Set current instance microsecond to the given value.
368 * @method self setMicrosecond(int $value) Set current instance microsecond to the given value.
369 * @method CarbonInterface addYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval).
370 * @method CarbonInterface addYear() Add one year to the instance (using date interval).
371 * @method CarbonInterface subYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
372 * @method CarbonInterface subYear() Sub one year to the instance (using date interval).
373 * @method CarbonInterface addYearsWithOverflow(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
374 * @method CarbonInterface addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed.
375 * @method CarbonInterface subYearsWithOverflow(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
376 * @method CarbonInterface subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed.
377 * @method CarbonInterface addYearsWithoutOverflow(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
378 * @method CarbonInterface addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
379 * @method CarbonInterface subYearsWithoutOverflow(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
380 * @method CarbonInterface subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
381 * @method CarbonInterface addYearsWithNoOverflow(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
382 * @method CarbonInterface addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
383 * @method CarbonInterface subYearsWithNoOverflow(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
384 * @method CarbonInterface subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
385 * @method CarbonInterface addYearsNoOverflow(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
386 * @method CarbonInterface addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
387 * @method CarbonInterface subYearsNoOverflow(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
388 * @method CarbonInterface subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
389 * @method CarbonInterface addMonths(int|float $value = 1) Add months (the $value count passed in) to the instance (using date interval).
390 * @method CarbonInterface addMonth() Add one month to the instance (using date interval).
391 * @method CarbonInterface subMonths(int|float $value = 1) Sub months (the $value count passed in) to the instance (using date interval).
392 * @method CarbonInterface subMonth() Sub one month to the instance (using date interval).
393 * @method CarbonInterface addMonthsWithOverflow(int|float $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
394 * @method CarbonInterface addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed.
395 * @method CarbonInterface subMonthsWithOverflow(int|float $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
396 * @method CarbonInterface subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed.
397 * @method CarbonInterface addMonthsWithoutOverflow(int|float $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
398 * @method CarbonInterface addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
399 * @method CarbonInterface subMonthsWithoutOverflow(int|float $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
400 * @method CarbonInterface subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
401 * @method CarbonInterface addMonthsWithNoOverflow(int|float $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
402 * @method CarbonInterface addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
403 * @method CarbonInterface subMonthsWithNoOverflow(int|float $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
404 * @method CarbonInterface subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
405 * @method CarbonInterface addMonthsNoOverflow(int|float $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
406 * @method CarbonInterface addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
407 * @method CarbonInterface subMonthsNoOverflow(int|float $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
408 * @method CarbonInterface subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
409 * @method CarbonInterface addDays(int|float $value = 1) Add days (the $value count passed in) to the instance (using date interval).
410 * @method CarbonInterface addDay() Add one day to the instance (using date interval).
411 * @method CarbonInterface subDays(int|float $value = 1) Sub days (the $value count passed in) to the instance (using date interval).
412 * @method CarbonInterface subDay() Sub one day to the instance (using date interval).
413 * @method CarbonInterface addHours(int|float $value = 1) Add hours (the $value count passed in) to the instance (using date interval).
414 * @method CarbonInterface addHour() Add one hour to the instance (using date interval).
415 * @method CarbonInterface subHours(int|float $value = 1) Sub hours (the $value count passed in) to the instance (using date interval).
416 * @method CarbonInterface subHour() Sub one hour to the instance (using date interval).
417 * @method CarbonInterface addMinutes(int|float $value = 1) Add minutes (the $value count passed in) to the instance (using date interval).
418 * @method CarbonInterface addMinute() Add one minute to the instance (using date interval).
419 * @method CarbonInterface subMinutes(int|float $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval).
420 * @method CarbonInterface subMinute() Sub one minute to the instance (using date interval).
421 * @method CarbonInterface addSeconds(int|float $value = 1) Add seconds (the $value count passed in) to the instance (using date interval).
422 * @method CarbonInterface addSecond() Add one second to the instance (using date interval).
423 * @method CarbonInterface subSeconds(int|float $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval).
424 * @method CarbonInterface subSecond() Sub one second to the instance (using date interval).
425 * @method CarbonInterface addMillis(int|float $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval).
426 * @method CarbonInterface addMilli() Add one millisecond to the instance (using date interval).
427 * @method CarbonInterface subMillis(int|float $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval).
428 * @method CarbonInterface subMilli() Sub one millisecond to the instance (using date interval).
429 * @method CarbonInterface addMilliseconds(int|float $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval).
430 * @method CarbonInterface addMillisecond() Add one millisecond to the instance (using date interval).
431 * @method CarbonInterface subMilliseconds(int|float $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval).
432 * @method CarbonInterface subMillisecond() Sub one millisecond to the instance (using date interval).
433 * @method CarbonInterface addMicros(int|float $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval).
434 * @method CarbonInterface addMicro() Add one microsecond to the instance (using date interval).
435 * @method CarbonInterface subMicros(int|float $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval).
436 * @method CarbonInterface subMicro() Sub one microsecond to the instance (using date interval).
437 * @method CarbonInterface addMicroseconds(int|float $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval).
438 * @method CarbonInterface addMicrosecond() Add one microsecond to the instance (using date interval).
439 * @method CarbonInterface subMicroseconds(int|float $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval).
440 * @method CarbonInterface subMicrosecond() Sub one microsecond to the instance (using date interval).
441 * @method CarbonInterface addMillennia(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using date interval).
442 * @method CarbonInterface addMillennium() Add one millennium to the instance (using date interval).
443 * @method CarbonInterface subMillennia(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval).
444 * @method CarbonInterface subMillennium() Sub one millennium to the instance (using date interval).
445 * @method CarbonInterface addMillenniaWithOverflow(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
446 * @method CarbonInterface addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed.
447 * @method CarbonInterface subMillenniaWithOverflow(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
448 * @method CarbonInterface subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed.
449 * @method CarbonInterface addMillenniaWithoutOverflow(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
450 * @method CarbonInterface addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
451 * @method CarbonInterface subMillenniaWithoutOverflow(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
452 * @method CarbonInterface subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
453 * @method CarbonInterface addMillenniaWithNoOverflow(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
454 * @method CarbonInterface addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
455 * @method CarbonInterface subMillenniaWithNoOverflow(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
456 * @method CarbonInterface subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
457 * @method CarbonInterface addMillenniaNoOverflow(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
458 * @method CarbonInterface addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
459 * @method CarbonInterface subMillenniaNoOverflow(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
460 * @method CarbonInterface subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
461 * @method CarbonInterface addCenturies(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using date interval).
462 * @method CarbonInterface addCentury() Add one century to the instance (using date interval).
463 * @method CarbonInterface subCenturies(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval).
464 * @method CarbonInterface subCentury() Sub one century to the instance (using date interval).
465 * @method CarbonInterface addCenturiesWithOverflow(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
466 * @method CarbonInterface addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed.
467 * @method CarbonInterface subCenturiesWithOverflow(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
468 * @method CarbonInterface subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed.
469 * @method CarbonInterface addCenturiesWithoutOverflow(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
470 * @method CarbonInterface addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
471 * @method CarbonInterface subCenturiesWithoutOverflow(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
472 * @method CarbonInterface subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
473 * @method CarbonInterface addCenturiesWithNoOverflow(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
474 * @method CarbonInterface addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
475 * @method CarbonInterface subCenturiesWithNoOverflow(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
476 * @method CarbonInterface subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
477 * @method CarbonInterface addCenturiesNoOverflow(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
478 * @method CarbonInterface addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
479 * @method CarbonInterface subCenturiesNoOverflow(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
480 * @method CarbonInterface subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
481 * @method CarbonInterface addDecades(int|float $value = 1) Add decades (the $value count passed in) to the instance (using date interval).
482 * @method CarbonInterface addDecade() Add one decade to the instance (using date interval).
483 * @method CarbonInterface subDecades(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using date interval).
484 * @method CarbonInterface subDecade() Sub one decade to the instance (using date interval).
485 * @method CarbonInterface addDecadesWithOverflow(int|float $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
486 * @method CarbonInterface addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed.
487 * @method CarbonInterface subDecadesWithOverflow(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
488 * @method CarbonInterface subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed.
489 * @method CarbonInterface addDecadesWithoutOverflow(int|float $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
490 * @method CarbonInterface addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
491 * @method CarbonInterface subDecadesWithoutOverflow(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
492 * @method CarbonInterface subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
493 * @method CarbonInterface addDecadesWithNoOverflow(int|float $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
494 * @method CarbonInterface addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
495 * @method CarbonInterface subDecadesWithNoOverflow(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
496 * @method CarbonInterface subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
497 * @method CarbonInterface addDecadesNoOverflow(int|float $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
498 * @method CarbonInterface addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
499 * @method CarbonInterface subDecadesNoOverflow(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
500 * @method CarbonInterface subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
501 * @method CarbonInterface addQuarters(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using date interval).
502 * @method CarbonInterface addQuarter() Add one quarter to the instance (using date interval).
503 * @method CarbonInterface subQuarters(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval).
504 * @method CarbonInterface subQuarter() Sub one quarter to the instance (using date interval).
505 * @method CarbonInterface addQuartersWithOverflow(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
506 * @method CarbonInterface addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed.
507 * @method CarbonInterface subQuartersWithOverflow(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
508 * @method CarbonInterface subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed.
509 * @method CarbonInterface addQuartersWithoutOverflow(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
510 * @method CarbonInterface addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
511 * @method CarbonInterface subQuartersWithoutOverflow(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
512 * @method CarbonInterface subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
513 * @method CarbonInterface addQuartersWithNoOverflow(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
514 * @method CarbonInterface addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
515 * @method CarbonInterface subQuartersWithNoOverflow(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
516 * @method CarbonInterface subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
517 * @method CarbonInterface addQuartersNoOverflow(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
518 * @method CarbonInterface addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
519 * @method CarbonInterface subQuartersNoOverflow(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
520 * @method CarbonInterface subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
521 * @method CarbonInterface addWeeks(int|float $value = 1) Add weeks (the $value count passed in) to the instance (using date interval).
522 * @method CarbonInterface addWeek() Add one week to the instance (using date interval).
523 * @method CarbonInterface subWeeks(int|float $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval).
524 * @method CarbonInterface subWeek() Sub one week to the instance (using date interval).
525 * @method CarbonInterface addWeekdays(int|float $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval).
526 * @method CarbonInterface addWeekday() Add one weekday to the instance (using date interval).
527 * @method CarbonInterface subWeekdays(int|float $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval).
528 * @method CarbonInterface subWeekday() Sub one weekday to the instance (using date interval).
529 * @method CarbonInterface addUTCMicros(int|float $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp).
530 * @method CarbonInterface addUTCMicro() Add one microsecond to the instance (using timestamp).
531 * @method CarbonInterface subUTCMicros(int|float $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp).
532 * @method CarbonInterface subUTCMicro() Sub one microsecond to the instance (using timestamp).
533 * @method CarbonPeriod microsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.
534 * @method float diffInUTCMicros(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of microseconds.
535 * @method CarbonInterface addUTCMicroseconds(int|float $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp).
536 * @method CarbonInterface addUTCMicrosecond() Add one microsecond to the instance (using timestamp).
537 * @method CarbonInterface subUTCMicroseconds(int|float $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp).
538 * @method CarbonInterface subUTCMicrosecond() Sub one microsecond to the instance (using timestamp).
539 * @method CarbonPeriod microsecondsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.
540 * @method float diffInUTCMicroseconds(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of microseconds.
541 * @method CarbonInterface addUTCMillis(int|float $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp).
542 * @method CarbonInterface addUTCMilli() Add one millisecond to the instance (using timestamp).
543 * @method CarbonInterface subUTCMillis(int|float $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp).
544 * @method CarbonInterface subUTCMilli() Sub one millisecond to the instance (using timestamp).
545 * @method CarbonPeriod millisUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.
546 * @method float diffInUTCMillis(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of milliseconds.
547 * @method CarbonInterface addUTCMilliseconds(int|float $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp).
548 * @method CarbonInterface addUTCMillisecond() Add one millisecond to the instance (using timestamp).
549 * @method CarbonInterface subUTCMilliseconds(int|float $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp).
550 * @method CarbonInterface subUTCMillisecond() Sub one millisecond to the instance (using timestamp).
551 * @method CarbonPeriod millisecondsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.
552 * @method float diffInUTCMilliseconds(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of milliseconds.
553 * @method CarbonInterface addUTCSeconds(int|float $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp).
554 * @method CarbonInterface addUTCSecond() Add one second to the instance (using timestamp).
555 * @method CarbonInterface subUTCSeconds(int|float $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp).
556 * @method CarbonInterface subUTCSecond() Sub one second to the instance (using timestamp).
557 * @method CarbonPeriod secondsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given.
558 * @method float diffInUTCSeconds(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of seconds.
559 * @method CarbonInterface addUTCMinutes(int|float $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp).
560 * @method CarbonInterface addUTCMinute() Add one minute to the instance (using timestamp).
561 * @method CarbonInterface subUTCMinutes(int|float $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp).
562 * @method CarbonInterface subUTCMinute() Sub one minute to the instance (using timestamp).
563 * @method CarbonPeriod minutesUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given.
564 * @method float diffInUTCMinutes(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of minutes.
565 * @method CarbonInterface addUTCHours(int|float $value = 1) Add hours (the $value count passed in) to the instance (using timestamp).
566 * @method CarbonInterface addUTCHour() Add one hour to the instance (using timestamp).
567 * @method CarbonInterface subUTCHours(int|float $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp).
568 * @method CarbonInterface subUTCHour() Sub one hour to the instance (using timestamp).
569 * @method CarbonPeriod hoursUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given.
570 * @method float diffInUTCHours(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of hours.
571 * @method CarbonInterface addUTCDays(int|float $value = 1) Add days (the $value count passed in) to the instance (using timestamp).
572 * @method CarbonInterface addUTCDay() Add one day to the instance (using timestamp).
573 * @method CarbonInterface subUTCDays(int|float $value = 1) Sub days (the $value count passed in) to the instance (using timestamp).
574 * @method CarbonInterface subUTCDay() Sub one day to the instance (using timestamp).
575 * @method CarbonPeriod daysUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given.
576 * @method float diffInUTCDays(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of days.
577 * @method CarbonInterface addUTCWeeks(int|float $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp).
578 * @method CarbonInterface addUTCWeek() Add one week to the instance (using timestamp).
579 * @method CarbonInterface subUTCWeeks(int|float $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp).
580 * @method CarbonInterface subUTCWeek() Sub one week to the instance (using timestamp).
581 * @method CarbonPeriod weeksUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given.
582 * @method float diffInUTCWeeks(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of weeks.
583 * @method CarbonInterface addUTCMonths(int|float $value = 1) Add months (the $value count passed in) to the instance (using timestamp).
584 * @method CarbonInterface addUTCMonth() Add one month to the instance (using timestamp).
585 * @method CarbonInterface subUTCMonths(int|float $value = 1) Sub months (the $value count passed in) to the instance (using timestamp).
586 * @method CarbonInterface subUTCMonth() Sub one month to the instance (using timestamp).
587 * @method CarbonPeriod monthsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given.
588 * @method float diffInUTCMonths(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of months.
589 * @method CarbonInterface addUTCQuarters(int|float $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp).
590 * @method CarbonInterface addUTCQuarter() Add one quarter to the instance (using timestamp).
591 * @method CarbonInterface subUTCQuarters(int|float $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp).
592 * @method CarbonInterface subUTCQuarter() Sub one quarter to the instance (using timestamp).
593 * @method CarbonPeriod quartersUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given.
594 * @method float diffInUTCQuarters(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of quarters.
595 * @method CarbonInterface addUTCYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using timestamp).
596 * @method CarbonInterface addUTCYear() Add one year to the instance (using timestamp).
597 * @method CarbonInterface subUTCYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using timestamp).
598 * @method CarbonInterface subUTCYear() Sub one year to the instance (using timestamp).
599 * @method CarbonPeriod yearsUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given.
600 * @method float diffInUTCYears(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of years.
601 * @method CarbonInterface addUTCDecades(int|float $value = 1) Add decades (the $value count passed in) to the instance (using timestamp).
602 * @method CarbonInterface addUTCDecade() Add one decade to the instance (using timestamp).
603 * @method CarbonInterface subUTCDecades(int|float $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp).
604 * @method CarbonInterface subUTCDecade() Sub one decade to the instance (using timestamp).
605 * @method CarbonPeriod decadesUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given.
606 * @method float diffInUTCDecades(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of decades.
607 * @method CarbonInterface addUTCCenturies(int|float $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp).
608 * @method CarbonInterface addUTCCentury() Add one century to the instance (using timestamp).
609 * @method CarbonInterface subUTCCenturies(int|float $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp).
610 * @method CarbonInterface subUTCCentury() Sub one century to the instance (using timestamp).
611 * @method CarbonPeriod centuriesUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given.
612 * @method float diffInUTCCenturies(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of centuries.
613 * @method CarbonInterface addUTCMillennia(int|float $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp).
614 * @method CarbonInterface addUTCMillennium() Add one millennium to the instance (using timestamp).
615 * @method CarbonInterface subUTCMillennia(int|float $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp).
616 * @method CarbonInterface subUTCMillennium() Sub one millennium to the instance (using timestamp).
617 * @method CarbonPeriod millenniaUntil($endDate = null, int|float $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given.
618 * @method float diffInUTCMillennia(DateTimeInterface|string|null $date, bool $absolute = false) Convert current and given date in UTC timezone and return a floating number of millennia.
619 * @method CarbonInterface roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function.
620 * @method CarbonInterface roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function.
621 * @method CarbonInterface floorYear(float $precision = 1) Truncate the current instance year with given precision.
622 * @method CarbonInterface floorYears(float $precision = 1) Truncate the current instance year with given precision.
623 * @method CarbonInterface ceilYear(float $precision = 1) Ceil the current instance year with given precision.
624 * @method CarbonInterface ceilYears(float $precision = 1) Ceil the current instance year with given precision.
625 * @method CarbonInterface roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function.
626 * @method CarbonInterface roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function.
627 * @method CarbonInterface floorMonth(float $precision = 1) Truncate the current instance month with given precision.
628 * @method CarbonInterface floorMonths(float $precision = 1) Truncate the current instance month with given precision.
629 * @method CarbonInterface ceilMonth(float $precision = 1) Ceil the current instance month with given precision.
630 * @method CarbonInterface ceilMonths(float $precision = 1) Ceil the current instance month with given precision.
631 * @method CarbonInterface roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function.
632 * @method CarbonInterface roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function.
633 * @method CarbonInterface floorDay(float $precision = 1) Truncate the current instance day with given precision.
634 * @method CarbonInterface floorDays(float $precision = 1) Truncate the current instance day with given precision.
635 * @method CarbonInterface ceilDay(float $precision = 1) Ceil the current instance day with given precision.
636 * @method CarbonInterface ceilDays(float $precision = 1) Ceil the current instance day with given precision.
637 * @method CarbonInterface roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function.
638 * @method CarbonInterface roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function.
639 * @method CarbonInterface floorHour(float $precision = 1) Truncate the current instance hour with given precision.
640 * @method CarbonInterface floorHours(float $precision = 1) Truncate the current instance hour with given precision.
641 * @method CarbonInterface ceilHour(float $precision = 1) Ceil the current instance hour with given precision.
642 * @method CarbonInterface ceilHours(float $precision = 1) Ceil the current instance hour with given precision.
643 * @method CarbonInterface roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function.
644 * @method CarbonInterface roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function.
645 * @method CarbonInterface floorMinute(float $precision = 1) Truncate the current instance minute with given precision.
646 * @method CarbonInterface floorMinutes(float $precision = 1) Truncate the current instance minute with given precision.
647 * @method CarbonInterface ceilMinute(float $precision = 1) Ceil the current instance minute with given precision.
648 * @method CarbonInterface ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision.
649 * @method CarbonInterface roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function.
650 * @method CarbonInterface roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function.
651 * @method CarbonInterface floorSecond(float $precision = 1) Truncate the current instance second with given precision.
652 * @method CarbonInterface floorSeconds(float $precision = 1) Truncate the current instance second with given precision.
653 * @method CarbonInterface ceilSecond(float $precision = 1) Ceil the current instance second with given precision.
654 * @method CarbonInterface ceilSeconds(float $precision = 1) Ceil the current instance second with given precision.
655 * @method CarbonInterface roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function.
656 * @method CarbonInterface roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function.
657 * @method CarbonInterface floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision.
658 * @method CarbonInterface floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision.
659 * @method CarbonInterface ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision.
660 * @method CarbonInterface ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision.
661 * @method CarbonInterface roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function.
662 * @method CarbonInterface roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function.
663 * @method CarbonInterface floorCentury(float $precision = 1) Truncate the current instance century with given precision.
664 * @method CarbonInterface floorCenturies(float $precision = 1) Truncate the current instance century with given precision.
665 * @method CarbonInterface ceilCentury(float $precision = 1) Ceil the current instance century with given precision.
666 * @method CarbonInterface ceilCenturies(float $precision = 1) Ceil the current instance century with given precision.
667 * @method CarbonInterface roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function.
668 * @method CarbonInterface roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function.
669 * @method CarbonInterface floorDecade(float $precision = 1) Truncate the current instance decade with given precision.
670 * @method CarbonInterface floorDecades(float $precision = 1) Truncate the current instance decade with given precision.
671 * @method CarbonInterface ceilDecade(float $precision = 1) Ceil the current instance decade with given precision.
672 * @method CarbonInterface ceilDecades(float $precision = 1) Ceil the current instance decade with given precision.
673 * @method CarbonInterface roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function.
674 * @method CarbonInterface roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function.
675 * @method CarbonInterface floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision.
676 * @method CarbonInterface floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision.
677 * @method CarbonInterface ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision.
678 * @method CarbonInterface ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision.
679 * @method CarbonInterface roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function.
680 * @method CarbonInterface roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function.
681 * @method CarbonInterface floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision.
682 * @method CarbonInterface floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision.
683 * @method CarbonInterface ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision.
684 * @method CarbonInterface ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision.
685 * @method CarbonInterface roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function.
686 * @method CarbonInterface roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function.
687 * @method CarbonInterface floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision.
688 * @method CarbonInterface floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision.
689 * @method CarbonInterface ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision.
690 * @method CarbonInterface ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision.
691 * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
692 * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
693 * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
694 * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
695 * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
696 * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
697 * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
698 * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
699 * @method int centuriesInMillennium() Return the number of centuries contained in the current millennium
700 * @method int|static centuryOfMillennium(?int $century = null) Return the value of the century starting from the beginning of the current millennium when called with no parameters, change the current century when called with an integer value
701 * @method int|static dayOfCentury(?int $day = null) Return the value of the day starting from the beginning of the current century when called with no parameters, change the current day when called with an integer value
702 * @method int|static dayOfDecade(?int $day = null) Return the value of the day starting from the beginning of the current decade when called with no parameters, change the current day when called with an integer value
703 * @method int|static dayOfMillennium(?int $day = null) Return the value of the day starting from the beginning of the current millennium when called with no parameters, change the current day when called with an integer value
704 * @method int|static dayOfMonth(?int $day = null) Return the value of the day starting from the beginning of the current month when called with no parameters, change the current day when called with an integer value
705 * @method int|static dayOfQuarter(?int $day = null) Return the value of the day starting from the beginning of the current quarter when called with no parameters, change the current day when called with an integer value
706 * @method int|static dayOfWeek(?int $day = null) Return the value of the day starting from the beginning of the current week when called with no parameters, change the current day when called with an integer value
707 * @method int daysInCentury() Return the number of days contained in the current century
708 * @method int daysInDecade() Return the number of days contained in the current decade
709 * @method int daysInMillennium() Return the number of days contained in the current millennium
710 * @method int daysInMonth() Return the number of days contained in the current month
711 * @method int daysInQuarter() Return the number of days contained in the current quarter
712 * @method int daysInWeek() Return the number of days contained in the current week
713 * @method int daysInYear() Return the number of days contained in the current year
714 * @method int|static decadeOfCentury(?int $decade = null) Return the value of the decade starting from the beginning of the current century when called with no parameters, change the current decade when called with an integer value
715 * @method int|static decadeOfMillennium(?int $decade = null) Return the value of the decade starting from the beginning of the current millennium when called with no parameters, change the current decade when called with an integer value
716 * @method int decadesInCentury() Return the number of decades contained in the current century
717 * @method int decadesInMillennium() Return the number of decades contained in the current millennium
718 * @method int|static hourOfCentury(?int $hour = null) Return the value of the hour starting from the beginning of the current century when called with no parameters, change the current hour when called with an integer value
719 * @method int|static hourOfDay(?int $hour = null) Return the value of the hour starting from the beginning of the current day when called with no parameters, change the current hour when called with an integer value
720 * @method int|static hourOfDecade(?int $hour = null) Return the value of the hour starting from the beginning of the current decade when called with no parameters, change the current hour when called with an integer value
721 * @method int|static hourOfMillennium(?int $hour = null) Return the value of the hour starting from the beginning of the current millennium when called with no parameters, change the current hour when called with an integer value
722 * @method int|static hourOfMonth(?int $hour = null) Return the value of the hour starting from the beginning of the current month when called with no parameters, change the current hour when called with an integer value
723 * @method int|static hourOfQuarter(?int $hour = null) Return the value of the hour starting from the beginning of the current quarter when called with no parameters, change the current hour when called with an integer value
724 * @method int|static hourOfWeek(?int $hour = null) Return the value of the hour starting from the beginning of the current week when called with no parameters, change the current hour when called with an integer value
725 * @method int|static hourOfYear(?int $hour = null) Return the value of the hour starting from the beginning of the current year when called with no parameters, change the current hour when called with an integer value
726 * @method int hoursInCentury() Return the number of hours contained in the current century
727 * @method int hoursInDay() Return the number of hours contained in the current day
728 * @method int hoursInDecade() Return the number of hours contained in the current decade
729 * @method int hoursInMillennium() Return the number of hours contained in the current millennium
730 * @method int hoursInMonth() Return the number of hours contained in the current month
731 * @method int hoursInQuarter() Return the number of hours contained in the current quarter
732 * @method int hoursInWeek() Return the number of hours contained in the current week
733 * @method int hoursInYear() Return the number of hours contained in the current year
734 * @method int|static microsecondOfCentury(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current century when called with no parameters, change the current microsecond when called with an integer value
735 * @method int|static microsecondOfDay(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current day when called with no parameters, change the current microsecond when called with an integer value
736 * @method int|static microsecondOfDecade(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current decade when called with no parameters, change the current microsecond when called with an integer value
737 * @method int|static microsecondOfHour(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current hour when called with no parameters, change the current microsecond when called with an integer value
738 * @method int|static microsecondOfMillennium(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current millennium when called with no parameters, change the current microsecond when called with an integer value
739 * @method int|static microsecondOfMillisecond(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current millisecond when called with no parameters, change the current microsecond when called with an integer value
740 * @method int|static microsecondOfMinute(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current minute when called with no parameters, change the current microsecond when called with an integer value
741 * @method int|static microsecondOfMonth(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current month when called with no parameters, change the current microsecond when called with an integer value
742 * @method int|static microsecondOfQuarter(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current quarter when called with no parameters, change the current microsecond when called with an integer value
743 * @method int|static microsecondOfSecond(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current second when called with no parameters, change the current microsecond when called with an integer value
744 * @method int|static microsecondOfWeek(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current week when called with no parameters, change the current microsecond when called with an integer value
745 * @method int|static microsecondOfYear(?int $microsecond = null) Return the value of the microsecond starting from the beginning of the current year when called with no parameters, change the current microsecond when called with an integer value
746 * @method int microsecondsInCentury() Return the number of microseconds contained in the current century
747 * @method int microsecondsInDay() Return the number of microseconds contained in the current day
748 * @method int microsecondsInDecade() Return the number of microseconds contained in the current decade
749 * @method int microsecondsInHour() Return the number of microseconds contained in the current hour
750 * @method int microsecondsInMillennium() Return the number of microseconds contained in the current millennium
751 * @method int microsecondsInMillisecond() Return the number of microseconds contained in the current millisecond
752 * @method int microsecondsInMinute() Return the number of microseconds contained in the current minute
753 * @method int microsecondsInMonth() Return the number of microseconds contained in the current month
754 * @method int microsecondsInQuarter() Return the number of microseconds contained in the current quarter
755 * @method int microsecondsInSecond() Return the number of microseconds contained in the current second
756 * @method int microsecondsInWeek() Return the number of microseconds contained in the current week
757 * @method int microsecondsInYear() Return the number of microseconds contained in the current year
758 * @method int|static millisecondOfCentury(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current century when called with no parameters, change the current millisecond when called with an integer value
759 * @method int|static millisecondOfDay(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current day when called with no parameters, change the current millisecond when called with an integer value
760 * @method int|static millisecondOfDecade(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current decade when called with no parameters, change the current millisecond when called with an integer value
761 * @method int|static millisecondOfHour(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current hour when called with no parameters, change the current millisecond when called with an integer value
762 * @method int|static millisecondOfMillennium(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current millennium when called with no parameters, change the current millisecond when called with an integer value
763 * @method int|static millisecondOfMinute(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current minute when called with no parameters, change the current millisecond when called with an integer value
764 * @method int|static millisecondOfMonth(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current month when called with no parameters, change the current millisecond when called with an integer value
765 * @method int|static millisecondOfQuarter(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current quarter when called with no parameters, change the current millisecond when called with an integer value
766 * @method int|static millisecondOfSecond(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current second when called with no parameters, change the current millisecond when called with an integer value
767 * @method int|static millisecondOfWeek(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current week when called with no parameters, change the current millisecond when called with an integer value
768 * @method int|static millisecondOfYear(?int $millisecond = null) Return the value of the millisecond starting from the beginning of the current year when called with no parameters, change the current millisecond when called with an integer value
769 * @method int millisecondsInCentury() Return the number of milliseconds contained in the current century
770 * @method int millisecondsInDay() Return the number of milliseconds contained in the current day
771 * @method int millisecondsInDecade() Return the number of milliseconds contained in the current decade
772 * @method int millisecondsInHour() Return the number of milliseconds contained in the current hour
773 * @method int millisecondsInMillennium() Return the number of milliseconds contained in the current millennium
774 * @method int millisecondsInMinute() Return the number of milliseconds contained in the current minute
775 * @method int millisecondsInMonth() Return the number of milliseconds contained in the current month
776 * @method int millisecondsInQuarter() Return the number of milliseconds contained in the current quarter
777 * @method int millisecondsInSecond() Return the number of milliseconds contained in the current second
778 * @method int millisecondsInWeek() Return the number of milliseconds contained in the current week
779 * @method int millisecondsInYear() Return the number of milliseconds contained in the current year
780 * @method int|static minuteOfCentury(?int $minute = null) Return the value of the minute starting from the beginning of the current century when called with no parameters, change the current minute when called with an integer value
781 * @method int|static minuteOfDay(?int $minute = null) Return the value of the minute starting from the beginning of the current day when called with no parameters, change the current minute when called with an integer value
782 * @method int|static minuteOfDecade(?int $minute = null) Return the value of the minute starting from the beginning of the current decade when called with no parameters, change the current minute when called with an integer value
783 * @method int|static minuteOfHour(?int $minute = null) Return the value of the minute starting from the beginning of the current hour when called with no parameters, change the current minute when called with an integer value
784 * @method int|static minuteOfMillennium(?int $minute = null) Return the value of the minute starting from the beginning of the current millennium when called with no parameters, change the current minute when called with an integer value
785 * @method int|static minuteOfMonth(?int $minute = null) Return the value of the minute starting from the beginning of the current month when called with no parameters, change the current minute when called with an integer value
786 * @method int|static minuteOfQuarter(?int $minute = null) Return the value of the minute starting from the beginning of the current quarter when called with no parameters, change the current minute when called with an integer value
787 * @method int|static minuteOfWeek(?int $minute = null) Return the value of the minute starting from the beginning of the current week when called with no parameters, change the current minute when called with an integer value
788 * @method int|static minuteOfYear(?int $minute = null) Return the value of the minute starting from the beginning of the current year when called with no parameters, change the current minute when called with an integer value
789 * @method int minutesInCentury() Return the number of minutes contained in the current century
790 * @method int minutesInDay() Return the number of minutes contained in the current day
791 * @method int minutesInDecade() Return the number of minutes contained in the current decade
792 * @method int minutesInHour() Return the number of minutes contained in the current hour
793 * @method int minutesInMillennium() Return the number of minutes contained in the current millennium
794 * @method int minutesInMonth() Return the number of minutes contained in the current month
795 * @method int minutesInQuarter() Return the number of minutes contained in the current quarter
796 * @method int minutesInWeek() Return the number of minutes contained in the current week
797 * @method int minutesInYear() Return the number of minutes contained in the current year
798 * @method int|static monthOfCentury(?int $month = null) Return the value of the month starting from the beginning of the current century when called with no parameters, change the current month when called with an integer value
799 * @method int|static monthOfDecade(?int $month = null) Return the value of the month starting from the beginning of the current decade when called with no parameters, change the current month when called with an integer value
800 * @method int|static monthOfMillennium(?int $month = null) Return the value of the month starting from the beginning of the current millennium when called with no parameters, change the current month when called with an integer value
801 * @method int|static monthOfQuarter(?int $month = null) Return the value of the month starting from the beginning of the current quarter when called with no parameters, change the current month when called with an integer value
802 * @method int|static monthOfYear(?int $month = null) Return the value of the month starting from the beginning of the current year when called with no parameters, change the current month when called with an integer value
803 * @method int monthsInCentury() Return the number of months contained in the current century
804 * @method int monthsInDecade() Return the number of months contained in the current decade
805 * @method int monthsInMillennium() Return the number of months contained in the current millennium
806 * @method int monthsInQuarter() Return the number of months contained in the current quarter
807 * @method int monthsInYear() Return the number of months contained in the current year
808 * @method int|static quarterOfCentury(?int $quarter = null) Return the value of the quarter starting from the beginning of the current century when called with no parameters, change the current quarter when called with an integer value
809 * @method int|static quarterOfDecade(?int $quarter = null) Return the value of the quarter starting from the beginning of the current decade when called with no parameters, change the current quarter when called with an integer value
810 * @method int|static quarterOfMillennium(?int $quarter = null) Return the value of the quarter starting from the beginning of the current millennium when called with no parameters, change the current quarter when called with an integer value
811 * @method int|static quarterOfYear(?int $quarter = null) Return the value of the quarter starting from the beginning of the current year when called with no parameters, change the current quarter when called with an integer value
812 * @method int quartersInCentury() Return the number of quarters contained in the current century
813 * @method int quartersInDecade() Return the number of quarters contained in the current decade
814 * @method int quartersInMillennium() Return the number of quarters contained in the current millennium
815 * @method int quartersInYear() Return the number of quarters contained in the current year
816 * @method int|static secondOfCentury(?int $second = null) Return the value of the second starting from the beginning of the current century when called with no parameters, change the current second when called with an integer value
817 * @method int|static secondOfDay(?int $second = null) Return the value of the second starting from the beginning of the current day when called with no parameters, change the current second when called with an integer value
818 * @method int|static secondOfDecade(?int $second = null) Return the value of the second starting from the beginning of the current decade when called with no parameters, change the current second when called with an integer value
819 * @method int|static secondOfHour(?int $second = null) Return the value of the second starting from the beginning of the current hour when called with no parameters, change the current second when called with an integer value
820 * @method int|static secondOfMillennium(?int $second = null) Return the value of the second starting from the beginning of the current millennium when called with no parameters, change the current second when called with an integer value
821 * @method int|static secondOfMinute(?int $second = null) Return the value of the second starting from the beginning of the current minute when called with no parameters, change the current second when called with an integer value
822 * @method int|static secondOfMonth(?int $second = null) Return the value of the second starting from the beginning of the current month when called with no parameters, change the current second when called with an integer value
823 * @method int|static secondOfQuarter(?int $second = null) Return the value of the second starting from the beginning of the current quarter when called with no parameters, change the current second when called with an integer value
824 * @method int|static secondOfWeek(?int $second = null) Return the value of the second starting from the beginning of the current week when called with no parameters, change the current second when called with an integer value
825 * @method int|static secondOfYear(?int $second = null) Return the value of the second starting from the beginning of the current year when called with no parameters, change the current second when called with an integer value
826 * @method int secondsInCentury() Return the number of seconds contained in the current century
827 * @method int secondsInDay() Return the number of seconds contained in the current day
828 * @method int secondsInDecade() Return the number of seconds contained in the current decade
829 * @method int secondsInHour() Return the number of seconds contained in the current hour
830 * @method int secondsInMillennium() Return the number of seconds contained in the current millennium
831 * @method int secondsInMinute() Return the number of seconds contained in the current minute
832 * @method int secondsInMonth() Return the number of seconds contained in the current month
833 * @method int secondsInQuarter() Return the number of seconds contained in the current quarter
834 * @method int secondsInWeek() Return the number of seconds contained in the current week
835 * @method int secondsInYear() Return the number of seconds contained in the current year
836 * @method int|static weekOfCentury(?int $week = null) Return the value of the week starting from the beginning of the current century when called with no parameters, change the current week when called with an integer value
837 * @method int|static weekOfDecade(?int $week = null) Return the value of the week starting from the beginning of the current decade when called with no parameters, change the current week when called with an integer value
838 * @method int|static weekOfMillennium(?int $week = null) Return the value of the week starting from the beginning of the current millennium when called with no parameters, change the current week when called with an integer value
839 * @method int|static weekOfMonth(?int $week = null) Return the value of the week starting from the beginning of the current month when called with no parameters, change the current week when called with an integer value
840 * @method int|static weekOfQuarter(?int $week = null) Return the value of the week starting from the beginning of the current quarter when called with no parameters, change the current week when called with an integer value
841 * @method int|static weekOfYear(?int $week = null) Return the value of the week starting from the beginning of the current year when called with no parameters, change the current week when called with an integer value
842 * @method int weeksInCentury() Return the number of weeks contained in the current century
843 * @method int weeksInDecade() Return the number of weeks contained in the current decade
844 * @method int weeksInMillennium() Return the number of weeks contained in the current millennium
845 * @method int weeksInMonth() Return the number of weeks contained in the current month
846 * @method int weeksInQuarter() Return the number of weeks contained in the current quarter
847 * @method int|static yearOfCentury(?int $year = null) Return the value of the year starting from the beginning of the current century when called with no parameters, change the current year when called with an integer value
848 * @method int|static yearOfDecade(?int $year = null) Return the value of the year starting from the beginning of the current decade when called with no parameters, change the current year when called with an integer value
849 * @method int|static yearOfMillennium(?int $year = null) Return the value of the year starting from the beginning of the current millennium when called with no parameters, change the current year when called with an integer value
850 * @method int yearsInCentury() Return the number of years contained in the current century
851 * @method int yearsInDecade() Return the number of years contained in the current decade
852 * @method int yearsInMillennium() Return the number of years contained in the current millennium
853 *
854 * </autodoc>
855 *
856 * @codeCoverageIgnore
857 */
858 interface CarbonInterface extends DateTimeInterface, JsonSerializable, DiffOptions, Format, TranslationOptions, UnitValue
859 {
860 // <methods>
861
862 /**
863 * Dynamically handle calls to the class.
864 *
865 * @param string $method magic method name called
866 * @param array $parameters parameters list
867 *
868 * @throws UnknownMethodException|BadMethodCallException|ReflectionException|Throwable
869 */
870 public function __call(string $method, array $parameters): mixed;
871
872 /**
873 * Dynamically handle calls to the class.
874 *
875 * @param string $method magic method name called
876 * @param array $parameters parameters list
877 *
878 * @throws BadMethodCallException
879 */
880 public static function __callStatic(string $method, array $parameters): mixed;
881
882 /**
883 * Update constructedObjectId on cloned.
884 */
885 public function __clone(): void;
886
887 /**
888 * Create a new Carbon instance.
889 *
890 * Please see the testing aids section (specifically static::setTestNow())
891 * for more on the possibility of this constructor returning a test instance.
892 *
893 * @throws InvalidFormatException
894 */
895 public function __construct(DateTimeInterface|WeekDay|Month|string|int|float|null $time = null, DateTimeZone|string|int|null $timezone = null);
896
897 /**
898 * Show truthy properties on var_dump().
899 */
900 public function __debugInfo(): array;
901
902 /**
903 * Get a part of the Carbon object.
904 *
905 * @throws UnknownGetterException
906 *
907 * @return string|int|bool|DateTimeZone|null
908 */
909 public function __get(string $name): mixed;
910
911 /**
912 * Check if an attribute exists on the object
913 *
914 * @param string $name
915 *
916 * @return bool
917 */
918 public function __isset($name);
919
920 /**
921 * Set a part of the Carbon object
922 *
923 * @param string $name
924 * @param string|int|DateTimeZone $value
925 *
926 * @throws UnknownSetterException|ReflectionException
927 *
928 * @return void
929 */
930 public function __set($name, $value);
931
932 /**
933 * The __set_state handler.
934 *
935 * @param string|array $dump
936 *
937 * @return static
938 */
939 #[ReturnTypeWillChange]
940 public static function __set_state($dump): static;
941
942 /**
943 * Format the instance as a string using the set format
944 *
945 * @example
946 * ```
947 * echo Carbon::now(); // Carbon instances can be cast to string
948 * ```
949 */
950 public function __toString();
951
952 /**
953 * Add given units or interval to the current instance.
954 *
955 * @example $date->add('hour', 3)
956 * @example $date->add(15, 'days')
957 * @example $date->add(CarbonInterval::days(4))
958 *
959 * @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
960 * @param Unit|int|float|string $value
961 * @param bool|null $overflow
962 *
963 * @return static
964 */
965 #[ReturnTypeWillChange]
966 public function add($unit, $value = 1, ?bool $overflow = null): static;
967
968 /**
969 * @deprecated Prefer to use add addUTCUnit() which more accurately defines what it's doing.
970 *
971 * Add seconds to the instance using timestamp. Positive $value travels
972 * forward while negative $value travels into the past.
973 *
974 * @param string $unit
975 * @param int|float|null $value
976 *
977 * @return static
978 */
979 public function addRealUnit(string $unit, $value = 1): static;
980
981 /**
982 * Add seconds to the instance using timestamp. Positive $value travels
983 * forward while negative $value travels into the past.
984 *
985 * @param string $unit
986 * @param int|float|null $value
987 *
988 * @return static
989 */
990 public function addUTCUnit(string $unit, $value = 1): static;
991
992 /**
993 * Add given units to the current instance.
994 */
995 public function addUnit(Unit|string $unit, $value = 1, ?bool $overflow = null): static;
996
997 /**
998 * Add any unit to a new value without overflowing current other unit given.
999 *
1000 * @param string $valueUnit unit name to modify
1001 * @param int $value amount to add to the input unit
1002 * @param string $overflowUnit unit name to not overflow
1003 */
1004 public function addUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit): static;
1005
1006 /**
1007 * Get the difference in a human readable format in the current locale from an other
1008 * instance given to now
1009 *
1010 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
1011 * - 'syntax' entry (see below)
1012 * - 'short' entry (see below)
1013 * - 'parts' entry (see below)
1014 * - 'options' entry (see below)
1015 * - 'join' entry determines how to join multiple parts of the string
1016 * ` - if $join is a string, it's used as a joiner glue
1017 * ` - if $join is a callable/closure, it get the list of string and should return a string
1018 * ` - if $join is an array, the first item will be the default glue, and the second item
1019 * ` will be used instead of the glue for the last item
1020 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
1021 * ` - if $join is missing, a space will be used as glue
1022 * if int passed, it add modifiers:
1023 * Possible values:
1024 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
1025 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
1026 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
1027 * Default value: CarbonInterface::DIFF_ABSOLUTE
1028 * @param bool $short displays short format of time units
1029 * @param int $parts maximum number of parts to display (default value: 1: single part)
1030 * @param int $options human diff options
1031 *
1032 * @return string
1033 */
1034 public function ago($syntax = null, $short = false, $parts = 1, $options = null);
1035
1036 /**
1037 * Modify the current instance to the average of a given instance (default now) and the current instance
1038 * (second-precision).
1039 *
1040 * @param \Carbon\Carbon|\DateTimeInterface|null $date
1041 *
1042 * @return static
1043 */
1044 public function average($date = null);
1045
1046 /**
1047 * Clone the current instance if it's mutable.
1048 *
1049 * This method is convenient to ensure you don't mutate the initial object
1050 * but avoid to make a useless copy of it if it's already immutable.
1051 *
1052 * @return static
1053 */
1054 public function avoidMutation(): static;
1055
1056 /**
1057 * Determines if the instance is between two others.
1058 *
1059 * The third argument allow you to specify if bounds are included or not (true by default)
1060 * but for when you including/excluding bounds may produce different results in your application,
1061 * we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead.
1062 *
1063 * @example
1064 * ```
1065 * Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true
1066 * Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false
1067 * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // true
1068 * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', false); // false
1069 * ```
1070 *
1071 * @param bool $equal Indicates if an equal to comparison should be done
1072 */
1073 public function between(DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true): bool;
1074
1075 /**
1076 * Determines if the instance is between two others, bounds excluded.
1077 *
1078 * @example
1079 * ```
1080 * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-14', '2018-08-01'); // true
1081 * Carbon::parse('2018-07-25')->betweenExcluded('2018-08-01', '2018-08-20'); // false
1082 * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-25', '2018-08-01'); // false
1083 * ```
1084 */
1085 public function betweenExcluded(DateTimeInterface|string $date1, DateTimeInterface|string $date2): bool;
1086
1087 /**
1088 * Determines if the instance is between two others, bounds included.
1089 *
1090 * @example
1091 * ```
1092 * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-14', '2018-08-01'); // true
1093 * Carbon::parse('2018-07-25')->betweenIncluded('2018-08-01', '2018-08-20'); // false
1094 * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-25', '2018-08-01'); // true
1095 * ```
1096 */
1097 public function betweenIncluded(DateTimeInterface|string $date1, DateTimeInterface|string $date2): bool;
1098
1099 /**
1100 * Returns either day of week + time (e.g. "Last Friday at 3:30 PM") if reference time is within 7 days,
1101 * or a calendar date (e.g. "10/29/2017") otherwise.
1102 *
1103 * Language, date and time formats will change according to the current locale.
1104 *
1105 * @param Carbon|\DateTimeInterface|string|null $referenceTime
1106 * @param array $formats
1107 *
1108 * @return string
1109 */
1110 public function calendar($referenceTime = null, array $formats = []);
1111
1112 /**
1113 * Checks if the (date)time string is in a given format and valid to create a
1114 * new instance.
1115 *
1116 * @example
1117 * ```
1118 * Carbon::canBeCreatedFromFormat('11:12:45', 'h:i:s'); // true
1119 * Carbon::canBeCreatedFromFormat('13:12:45', 'h:i:s'); // false
1120 * ```
1121 */
1122 public static function canBeCreatedFromFormat(?string $date, string $format): bool;
1123
1124 /**
1125 * Return the Carbon instance passed through, a now instance in the same timezone
1126 * if null given or parse the input if string given.
1127 *
1128 * @param Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|DateTimeInterface|string|null $date
1129 *
1130 * @return static
1131 */
1132 public function carbonize($date = null);
1133
1134 /**
1135 * Cast the current instance into the given class.
1136 *
1137 * @template T
1138 *
1139 * @param class-string<T> $className The $className::instance() method will be called to cast the current object.
1140 *
1141 * @return T
1142 */
1143 public function cast(string $className): mixed;
1144
1145 /**
1146 * Ceil the current instance second with given precision if specified.
1147 */
1148 public function ceil(DateInterval|string|int|float $precision = 1): static;
1149
1150 /**
1151 * Ceil the current instance at the given unit with given precision if specified.
1152 */
1153 public function ceilUnit(string $unit, DateInterval|string|int|float $precision = 1): static;
1154
1155 /**
1156 * Ceil the current instance week.
1157 *
1158 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
1159 */
1160 public function ceilWeek(WeekDay|int|null $weekStartsAt = null): static;
1161
1162 /**
1163 * Similar to native modify() method of DateTime but can handle more grammars.
1164 *
1165 * @example
1166 * ```
1167 * echo Carbon::now()->change('next 2pm');
1168 * ```
1169 *
1170 * @link https://php.net/manual/en/datetime.modify.php
1171 *
1172 * @param string $modifier
1173 *
1174 * @return static
1175 */
1176 public function change($modifier);
1177
1178 /**
1179 * Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
1180 * foreach ($date as $_) {}
1181 * serializer($date)
1182 * var_export($date)
1183 * get_object_vars($date)
1184 */
1185 public function cleanupDumpProperties();
1186
1187 /**
1188 * @alias copy
1189 *
1190 * Get a copy of the instance.
1191 *
1192 * @return static
1193 */
1194 public function clone();
1195
1196 /**
1197 * Get the closest date from the instance (second-precision).
1198 *
1199 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1
1200 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2
1201 *
1202 * @return static
1203 */
1204 public function closest($date1, $date2);
1205
1206 /**
1207 * Get a copy of the instance.
1208 *
1209 * @return static
1210 */
1211 public function copy();
1212
1213 /**
1214 * Create a new Carbon instance from a specific date and time.
1215 *
1216 * If any of $year, $month or $day are set to null their now() values will
1217 * be used.
1218 *
1219 * If $hour is null it will be set to its now() value and the default
1220 * values for $minute and $second will be their now() values.
1221 *
1222 * If $hour is not null then the default values for $minute and $second
1223 * will be 0.
1224 *
1225 * @param DateTimeInterface|string|int|null $year
1226 * @param int|null $month
1227 * @param int|null $day
1228 * @param int|null $hour
1229 * @param int|null $minute
1230 * @param int|null $second
1231 * @param DateTimeZone|string|int|null $timezone
1232 *
1233 * @throws InvalidFormatException
1234 *
1235 * @return static|null
1236 */
1237 public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null): ?static;
1238
1239 /**
1240 * Create a Carbon instance from just a date. The time portion is set to now.
1241 *
1242 * @param int|null $year
1243 * @param int|null $month
1244 * @param int|null $day
1245 * @param DateTimeZone|string|int|null $timezone
1246 *
1247 * @throws InvalidFormatException
1248 *
1249 * @return static
1250 */
1251 public static function createFromDate($year = null, $month = null, $day = null, $timezone = null);
1252
1253 /**
1254 * Create a Carbon instance from a specific format.
1255 *
1256 * @param string $format Datetime format
1257 * @param string $time
1258 * @param DateTimeZone|string|int|null $timezone
1259 *
1260 * @throws InvalidFormatException
1261 *
1262 * @return static|null
1263 */
1264 #[ReturnTypeWillChange]
1265 public static function createFromFormat($format, $time, $timezone = null): ?static;
1266
1267 /**
1268 * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).
1269 *
1270 * @param string $format Datetime format
1271 * @param string $time
1272 * @param DateTimeZone|string|int|null $timezone optional timezone
1273 * @param string|null $locale locale to be used for LTS, LT, LL, LLL, etc. macro-formats (en by fault, unneeded if no such macro-format in use)
1274 * @param TranslatorInterface|null $translator optional custom translator to use for macro-formats
1275 *
1276 * @throws InvalidFormatException
1277 *
1278 * @return static|null
1279 */
1280 public static function createFromIsoFormat(string $format, string $time, $timezone = null, ?string $locale = 'en', ?TranslatorInterface $translator = null): ?static;
1281
1282 /**
1283 * Create a Carbon instance from a specific format and a string in a given language.
1284 *
1285 * @param string $format Datetime format
1286 * @param string $locale
1287 * @param string $time
1288 * @param DateTimeZone|string|int|null $timezone
1289 *
1290 * @throws InvalidFormatException
1291 *
1292 * @return static|null
1293 */
1294 public static function createFromLocaleFormat(string $format, string $locale, string $time, $timezone = null): ?static;
1295
1296 /**
1297 * Create a Carbon instance from a specific ISO format and a string in a given language.
1298 *
1299 * @param string $format Datetime ISO format
1300 * @param string $locale
1301 * @param string $time
1302 * @param DateTimeZone|string|int|null $timezone
1303 *
1304 * @throws InvalidFormatException
1305 *
1306 * @return static|null
1307 */
1308 public static function createFromLocaleIsoFormat(string $format, string $locale, string $time, $timezone = null): ?static;
1309
1310 /**
1311 * Create a Carbon instance from just a time. The date portion is set to today.
1312 *
1313 * @param int|null $hour
1314 * @param int|null $minute
1315 * @param int|null $second
1316 * @param DateTimeZone|string|int|null $timezone
1317 *
1318 * @throws InvalidFormatException
1319 *
1320 * @return static
1321 */
1322 public static function createFromTime($hour = 0, $minute = 0, $second = 0, $timezone = null): static;
1323
1324 /**
1325 * Create a Carbon instance from a time string. The date portion is set to today.
1326 *
1327 * @throws InvalidFormatException
1328 */
1329 public static function createFromTimeString(string $time, DateTimeZone|string|int|null $timezone = null): static;
1330
1331 /**
1332 * Create a Carbon instance from a timestamp and set the timezone (UTC by default).
1333 *
1334 * Timestamp input can be given as int, float or a string containing one or more numbers.
1335 */
1336 #[ReturnTypeWillChange]
1337 public static function createFromTimestamp(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null): static;
1338
1339 /**
1340 * Create a Carbon instance from a timestamp in milliseconds.
1341 *
1342 * Timestamp input can be given as int, float or a string containing one or more numbers.
1343 */
1344 public static function createFromTimestampMs(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null): static;
1345
1346 /**
1347 * Create a Carbon instance from a timestamp in milliseconds.
1348 *
1349 * Timestamp input can be given as int, float or a string containing one or more numbers.
1350 *
1351 * @param float|int|string $timestamp
1352 *
1353 * @return static
1354 */
1355 public static function createFromTimestampMsUTC($timestamp): static;
1356
1357 /**
1358 * Create a Carbon instance from a timestamp keeping the timezone to UTC.
1359 *
1360 * Timestamp input can be given as int, float or a string containing one or more numbers.
1361 */
1362 public static function createFromTimestampUTC(string|int|float $timestamp): static;
1363
1364 /**
1365 * Create a Carbon instance from just a date. The time portion is set to midnight.
1366 *
1367 * @param int|null $year
1368 * @param int|null $month
1369 * @param int|null $day
1370 * @param DateTimeZone|string|int|null $timezone
1371 *
1372 * @throws InvalidFormatException
1373 *
1374 * @return static
1375 */
1376 public static function createMidnightDate($year = null, $month = null, $day = null, $timezone = null);
1377
1378 /**
1379 * Create a new safe Carbon instance from a specific date and time.
1380 *
1381 * If any of $year, $month or $day are set to null their now() values will
1382 * be used.
1383 *
1384 * If $hour is null it will be set to its now() value and the default
1385 * values for $minute and $second will be their now() values.
1386 *
1387 * If $hour is not null then the default values for $minute and $second
1388 * will be 0.
1389 *
1390 * If one of the set values is not valid, an InvalidDateException
1391 * will be thrown.
1392 *
1393 * @param int|null $year
1394 * @param int|null $month
1395 * @param int|null $day
1396 * @param int|null $hour
1397 * @param int|null $minute
1398 * @param int|null $second
1399 * @param DateTimeZone|string|int|null $timezone
1400 *
1401 * @throws InvalidDateException
1402 *
1403 * @return static|null
1404 */
1405 public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null): ?static;
1406
1407 /**
1408 * Create a new Carbon instance from a specific date and time using strict validation.
1409 *
1410 * @see create()
1411 *
1412 * @param int|null $year
1413 * @param int|null $month
1414 * @param int|null $day
1415 * @param int|null $hour
1416 * @param int|null $minute
1417 * @param int|null $second
1418 * @param DateTimeZone|string|int|null $timezone
1419 *
1420 * @throws InvalidFormatException
1421 *
1422 * @return static
1423 */
1424 public static function createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null): static;
1425
1426 /**
1427 * Get/set the day of year.
1428 *
1429 * @template T of int|null
1430 *
1431 * @param int|null $value new value for day of year if using as setter.
1432 *
1433 * @psalm-param T $value
1434 *
1435 * @return static|int
1436 *
1437 * @psalm-return (T is int ? static : int)
1438 */
1439 public function dayOfYear(?int $value = null): static|int;
1440
1441 /**
1442 * Get the difference as a CarbonInterval instance.
1443 * Return relative interval (negative if $absolute flag is not set to true and the given date is before
1444 * current one).
1445 *
1446 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1447 * @param bool $absolute Get the absolute of the difference
1448 *
1449 * @return CarbonInterval
1450 */
1451 public function diffAsCarbonInterval($date = null, bool $absolute = false, array $skip = []): CarbonInterval;
1452
1453 /**
1454 * Get the difference as a DateInterval instance.
1455 * Return relative interval (negative if $absolute flag is not set to true and the given date is before
1456 * current one).
1457 *
1458 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1459 * @param bool $absolute Get the absolute of the difference
1460 *
1461 * @return DateInterval
1462 */
1463 public function diffAsDateInterval($date = null, bool $absolute = false): DateInterval;
1464
1465 /**
1466 * Get the difference by the given interval using a filter closure.
1467 *
1468 * @param CarbonInterval $ci An interval to traverse by
1469 * @param Closure $callback
1470 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1471 * @param bool $absolute Get the absolute of the difference
1472 *
1473 * @return int
1474 */
1475 public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, bool $absolute = false): int;
1476
1477 /**
1478 * Get the difference in a human readable format in the current locale from current instance to an other
1479 * instance given (or now if null given).
1480 *
1481 * @example
1482 * ```
1483 * echo Carbon::tomorrow()->diffForHumans() . "\n";
1484 * echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n";
1485 * echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n";
1486 * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n";
1487 * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n";
1488 * ```
1489 *
1490 * @param Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
1491 * if null passed, now will be used as comparison reference;
1492 * if any other type, it will be converted to date and used as reference.
1493 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
1494 * ⦿ 'syntax' entry (see below)
1495 * ⦿ 'short' entry (see below)
1496 * ⦿ 'parts' entry (see below)
1497 * ⦿ 'options' entry (see below)
1498 * ⦿ 'skip' entry, list of units to skip (array of strings or a single string,
1499 * ` it can be the unit name (singular or plural) or its shortcut
1500 * ` (y, m, w, d, h, min, s, ms, µs).
1501 * ⦿ 'aUnit' entry, prefer "an hour" over "1 hour" if true
1502 * ⦿ 'altNumbers' entry, use alternative numbers if available
1503 * ` (from the current language if true is passed, from the given language(s)
1504 * ` if array or string is passed)
1505 * ⦿ 'join' entry determines how to join multiple parts of the string
1506 * ` - if $join is a string, it's used as a joiner glue
1507 * ` - if $join is a callable/closure, it get the list of string and should return a string
1508 * ` - if $join is an array, the first item will be the default glue, and the second item
1509 * ` will be used instead of the glue for the last item
1510 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
1511 * ` - if $join is missing, a space will be used as glue
1512 * ⦿ 'other' entry (see above)
1513 * ⦿ 'minimumUnit' entry determines the smallest unit of time to display can be long or
1514 * ` short form of the units, e.g. 'hour' or 'h' (default value: s)
1515 * ⦿ 'locale' language in which the diff should be output (has no effect if 'translator' key is set)
1516 * ⦿ 'translator' a custom translator to use to translator the output.
1517 * if int passed, it adds modifiers:
1518 * Possible values:
1519 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
1520 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
1521 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
1522 * Default value: CarbonInterface::DIFF_ABSOLUTE
1523 * @param bool $short displays short format of time units
1524 * @param int $parts maximum number of parts to display (default value: 1: single unit)
1525 * @param int $options human diff options
1526 */
1527 public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null): string;
1528
1529 /**
1530 * Get the difference in days.
1531 *
1532 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1533 * @param bool $absolute Get the absolute of the difference
1534 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1535 *
1536 * @return float
1537 */
1538 public function diffInDays($date = null, bool $absolute = false, bool $utc = false): float;
1539
1540 /**
1541 * Get the difference in days using a filter closure.
1542 *
1543 * @param Closure $callback
1544 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1545 * @param bool $absolute Get the absolute of the difference
1546 *
1547 * @return int
1548 */
1549 public function diffInDaysFiltered(Closure $callback, $date = null, bool $absolute = false): int;
1550
1551 /**
1552 * Get the difference in hours.
1553 *
1554 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1555 * @param bool $absolute Get the absolute of the difference
1556 *
1557 * @return float
1558 */
1559 public function diffInHours($date = null, bool $absolute = false): float;
1560
1561 /**
1562 * Get the difference in hours using a filter closure.
1563 *
1564 * @param Closure $callback
1565 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1566 * @param bool $absolute Get the absolute of the difference
1567 *
1568 * @return int
1569 */
1570 public function diffInHoursFiltered(Closure $callback, $date = null, bool $absolute = false): int;
1571
1572 /**
1573 * Get the difference in microseconds.
1574 *
1575 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1576 * @param bool $absolute Get the absolute of the difference
1577 *
1578 * @return float
1579 */
1580 public function diffInMicroseconds($date = null, bool $absolute = false): float;
1581
1582 /**
1583 * Get the difference in milliseconds.
1584 *
1585 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1586 * @param bool $absolute Get the absolute of the difference
1587 *
1588 * @return float
1589 */
1590 public function diffInMilliseconds($date = null, bool $absolute = false): float;
1591
1592 /**
1593 * Get the difference in minutes.
1594 *
1595 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1596 * @param bool $absolute Get the absolute of the difference
1597 *
1598 * @return float
1599 */
1600 public function diffInMinutes($date = null, bool $absolute = false): float;
1601
1602 /**
1603 * Get the difference in months.
1604 *
1605 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1606 * @param bool $absolute Get the absolute of the difference
1607 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1608 *
1609 * @return float
1610 */
1611 public function diffInMonths($date = null, bool $absolute = false, bool $utc = false): float;
1612
1613 /**
1614 * Get the difference in quarters.
1615 *
1616 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1617 * @param bool $absolute Get the absolute of the difference
1618 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1619 *
1620 * @return float
1621 */
1622 public function diffInQuarters($date = null, bool $absolute = false, bool $utc = false): float;
1623
1624 /**
1625 * Get the difference in seconds.
1626 *
1627 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1628 * @param bool $absolute Get the absolute of the difference
1629 *
1630 * @return float
1631 */
1632 public function diffInSeconds($date = null, bool $absolute = false): float;
1633
1634 /**
1635 * @param Unit|string $unit microsecond, millisecond, second, minute,
1636 * hour, day, week, month, quarter, year,
1637 * century, millennium
1638 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1639 * @param bool $absolute Get the absolute of the difference
1640 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1641 *
1642 * @return float
1643 */
1644 public function diffInUnit(Unit|string $unit, $date = null, bool $absolute = false, bool $utc = false): float;
1645
1646 /**
1647 * Get the difference in weekdays.
1648 *
1649 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1650 * @param bool $absolute Get the absolute of the difference
1651 *
1652 * @return int
1653 */
1654 public function diffInWeekdays($date = null, bool $absolute = false): int;
1655
1656 /**
1657 * Get the difference in weekend days using a filter.
1658 *
1659 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1660 * @param bool $absolute Get the absolute of the difference
1661 *
1662 * @return int
1663 */
1664 public function diffInWeekendDays($date = null, bool $absolute = false): int;
1665
1666 /**
1667 * Get the difference in weeks.
1668 *
1669 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1670 * @param bool $absolute Get the absolute of the difference
1671 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1672 *
1673 * @return float
1674 */
1675 public function diffInWeeks($date = null, bool $absolute = false, bool $utc = false): float;
1676
1677 /**
1678 * Get the difference in years
1679 *
1680 * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
1681 * @param bool $absolute Get the absolute of the difference
1682 * @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
1683 *
1684 * @return float
1685 */
1686 public function diffInYears($date = null, bool $absolute = false, bool $utc = false): float;
1687
1688 /**
1689 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
1690 * You should rather use the ->settings() method.
1691 * @see settings
1692 */
1693 public static function disableHumanDiffOption(int $humanDiffOption): void;
1694
1695 /**
1696 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
1697 * You should rather use the ->settings() method.
1698 * @see settings
1699 */
1700 public static function enableHumanDiffOption(int $humanDiffOption): void;
1701
1702 /**
1703 * Modify to end of current given unit.
1704 *
1705 * @example
1706 * ```
1707 * echo Carbon::parse('2018-07-25 12:45:16.334455')
1708 * ->startOf(Unit::Month)
1709 * ->endOf(Unit::Week, Carbon::FRIDAY);
1710 * ```
1711 */
1712 public function endOf(Unit|string $unit, mixed ...$params): static;
1713
1714 /**
1715 * Resets the date to end of the century and time to 23:59:59.999999
1716 *
1717 * @example
1718 * ```
1719 * echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury();
1720 * ```
1721 *
1722 * @return static
1723 */
1724 public function endOfCentury();
1725
1726 /**
1727 * Resets the time to 23:59:59.999999 end of day
1728 *
1729 * @example
1730 * ```
1731 * echo Carbon::parse('2018-07-25 12:45:16')->endOfDay();
1732 * ```
1733 *
1734 * @return static
1735 */
1736 public function endOfDay();
1737
1738 /**
1739 * Resets the date to end of the decade and time to 23:59:59.999999
1740 *
1741 * @example
1742 * ```
1743 * echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade();
1744 * ```
1745 *
1746 * @return static
1747 */
1748 public function endOfDecade();
1749
1750 /**
1751 * Modify to end of current hour, minutes and seconds become 59
1752 *
1753 * @example
1754 * ```
1755 * echo Carbon::parse('2018-07-25 12:45:16')->endOfHour();
1756 * ```
1757 */
1758 public function endOfHour(): static;
1759
1760 /**
1761 * Resets the date to end of the millennium and time to 23:59:59.999999
1762 *
1763 * @example
1764 * ```
1765 * echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium();
1766 * ```
1767 *
1768 * @return static
1769 */
1770 public function endOfMillennium();
1771
1772 /**
1773 * Modify to end of current millisecond, microseconds such as 12345 become 123999
1774 *
1775 * @example
1776 * ```
1777 * echo Carbon::parse('2018-07-25 12:45:16.334455')
1778 * ->endOfSecond()
1779 * ->format('H:i:s.u');
1780 * ```
1781 */
1782 public function endOfMillisecond(): static;
1783
1784 /**
1785 * Modify to end of current minute, seconds become 59
1786 *
1787 * @example
1788 * ```
1789 * echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute();
1790 * ```
1791 */
1792 public function endOfMinute(): static;
1793
1794 /**
1795 * Resets the date to end of the month and time to 23:59:59.999999
1796 *
1797 * @example
1798 * ```
1799 * echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth();
1800 * ```
1801 *
1802 * @return static
1803 */
1804 public function endOfMonth();
1805
1806 /**
1807 * Resets the date to end of the quarter and time to 23:59:59.999999
1808 *
1809 * @example
1810 * ```
1811 * echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter();
1812 * ```
1813 *
1814 * @return static
1815 */
1816 public function endOfQuarter();
1817
1818 /**
1819 * Modify to end of current second, microseconds become 999999
1820 *
1821 * @example
1822 * ```
1823 * echo Carbon::parse('2018-07-25 12:45:16.334455')
1824 * ->endOfSecond()
1825 * ->format('H:i:s.u');
1826 * ```
1827 */
1828 public function endOfSecond(): static;
1829
1830 /**
1831 * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999
1832 *
1833 * @example
1834 * ```
1835 * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n";
1836 * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n";
1837 * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n";
1838 * ```
1839 *
1840 * @param WeekDay|int|null $weekEndsAt optional end allow you to specify the day of week to use to end the week
1841 *
1842 * @return static
1843 */
1844 public function endOfWeek(WeekDay|int|null $weekEndsAt = null): static;
1845
1846 /**
1847 * Resets the date to end of the year and time to 23:59:59.999999
1848 *
1849 * @example
1850 * ```
1851 * echo Carbon::parse('2018-07-25 12:45:16')->endOfYear();
1852 * ```
1853 *
1854 * @return static
1855 */
1856 public function endOfYear();
1857
1858 /**
1859 * Determines if the instance is equal to another
1860 *
1861 * @example
1862 * ```
1863 * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true
1864 * Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true
1865 * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false
1866 * ```
1867 *
1868 * @see equalTo()
1869 */
1870 public function eq(DateTimeInterface|string $date): bool;
1871
1872 /**
1873 * Determines if the instance is equal to another
1874 *
1875 * @example
1876 * ```
1877 * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true
1878 * Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true
1879 * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false
1880 * ```
1881 */
1882 public function equalTo(DateTimeInterface|string $date): bool;
1883
1884 /**
1885 * Set the current locale to the given, execute the passed function, reset the locale to previous one,
1886 * then return the result of the closure (or null if the closure was void).
1887 *
1888 * @param string $locale locale ex. en
1889 * @param callable $func
1890 *
1891 * @return mixed
1892 */
1893 public static function executeWithLocale(string $locale, callable $func): mixed;
1894
1895 /**
1896 * Get the farthest date from the instance (second-precision).
1897 *
1898 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1
1899 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2
1900 *
1901 * @return static
1902 */
1903 public function farthest($date1, $date2);
1904
1905 /**
1906 * Modify to the first occurrence of a given day of the week
1907 * in the current month. If no dayOfWeek is provided, modify to the
1908 * first day of the current month. Use the supplied constants
1909 * to indicate the desired dayOfWeek, ex. static::MONDAY.
1910 *
1911 * @param int|null $dayOfWeek
1912 *
1913 * @return static
1914 */
1915 public function firstOfMonth($dayOfWeek = null);
1916
1917 /**
1918 * Modify to the first occurrence of a given day of the week
1919 * in the current quarter. If no dayOfWeek is provided, modify to the
1920 * first day of the current quarter. Use the supplied constants
1921 * to indicate the desired dayOfWeek, ex. static::MONDAY.
1922 *
1923 * @param int|null $dayOfWeek day of the week default null
1924 *
1925 * @return static
1926 */
1927 public function firstOfQuarter($dayOfWeek = null);
1928
1929 /**
1930 * Modify to the first occurrence of a given day of the week
1931 * in the current year. If no dayOfWeek is provided, modify to the
1932 * first day of the current year. Use the supplied constants
1933 * to indicate the desired dayOfWeek, ex. static::MONDAY.
1934 *
1935 * @param int|null $dayOfWeek day of the week default null
1936 *
1937 * @return static
1938 */
1939 public function firstOfYear($dayOfWeek = null);
1940
1941 /**
1942 * Round the current instance second with given precision if specified.
1943 */
1944 public function floor(DateInterval|string|int|float $precision = 1): static;
1945
1946 /**
1947 * Truncate the current instance at the given unit with given precision if specified.
1948 */
1949 public function floorUnit(string $unit, DateInterval|string|int|float $precision = 1): static;
1950
1951 /**
1952 * Truncate the current instance week.
1953 *
1954 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
1955 */
1956 public function floorWeek(WeekDay|int|null $weekStartsAt = null): static;
1957
1958 /**
1959 * @alias diffForHumans
1960 *
1961 * Get the difference in a human readable format in the current locale from current instance to an other
1962 * instance given (or now if null given).
1963 *
1964 * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
1965 * if null passed, now will be used as comparison reference;
1966 * if any other type, it will be converted to date and used as reference.
1967 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
1968 * - 'syntax' entry (see below)
1969 * - 'short' entry (see below)
1970 * - 'parts' entry (see below)
1971 * - 'options' entry (see below)
1972 * - 'join' entry determines how to join multiple parts of the string
1973 * ` - if $join is a string, it's used as a joiner glue
1974 * ` - if $join is a callable/closure, it get the list of string and should return a string
1975 * ` - if $join is an array, the first item will be the default glue, and the second item
1976 * ` will be used instead of the glue for the last item
1977 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
1978 * ` - if $join is missing, a space will be used as glue
1979 * - 'other' entry (see above)
1980 * if int passed, it add modifiers:
1981 * Possible values:
1982 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
1983 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
1984 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
1985 * Default value: CarbonInterface::DIFF_ABSOLUTE
1986 * @param bool $short displays short format of time units
1987 * @param int $parts maximum number of parts to display (default value: 1: single unit)
1988 * @param int $options human diff options
1989 *
1990 * @return string
1991 */
1992 public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null);
1993
1994 /**
1995 * Get the difference in a human readable format in the current locale from current
1996 * instance to now.
1997 *
1998 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
1999 * - 'syntax' entry (see below)
2000 * - 'short' entry (see below)
2001 * - 'parts' entry (see below)
2002 * - 'options' entry (see below)
2003 * - 'join' entry determines how to join multiple parts of the string
2004 * ` - if $join is a string, it's used as a joiner glue
2005 * ` - if $join is a callable/closure, it get the list of string and should return a string
2006 * ` - if $join is an array, the first item will be the default glue, and the second item
2007 * ` will be used instead of the glue for the last item
2008 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
2009 * ` - if $join is missing, a space will be used as glue
2010 * if int passed, it add modifiers:
2011 * Possible values:
2012 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
2013 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
2014 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
2015 * Default value: CarbonInterface::DIFF_ABSOLUTE
2016 * @param bool $short displays short format of time units
2017 * @param int $parts maximum number of parts to display (default value: 1: single unit)
2018 * @param int $options human diff options
2019 *
2020 * @return string
2021 */
2022 public function fromNow($syntax = null, $short = false, $parts = 1, $options = null);
2023
2024 /**
2025 * Create an instance from a serialized string.
2026 *
2027 * If $value is not from a trusted source, consider using the allowed_classes option to limit
2028 * the types of objects that can be built, for instance:
2029 *
2030 * @example
2031 * ```php
2032 * $object = Carbon::fromSerialized($value, ['allowed_classes' => [Carbon::class, CarbonImmutable::class]]);
2033 * ```
2034 *
2035 * @param \Stringable|string $value
2036 * @param array $options example: ['allowed_classes' => [CarbonImmutable::class]]
2037 *
2038 * @throws InvalidFormatException
2039 *
2040 * @return static
2041 */
2042 public static function fromSerialized($value, array $options = []): static;
2043
2044 /**
2045 * Register a custom macro.
2046 *
2047 * @param callable $macro
2048 * @param int $priority marco with higher priority is tried first
2049 *
2050 * @return void
2051 */
2052 public static function genericMacro(callable $macro, int $priority = 0): void;
2053
2054 /**
2055 * Get a part of the Carbon object.
2056 *
2057 * @throws UnknownGetterException
2058 *
2059 * @return string|int|bool|DateTimeZone
2060 */
2061 public function get(Unit|string $name): mixed;
2062
2063 /**
2064 * Returns the alternative number for a given date property if available in the current locale.
2065 *
2066 * @param string $key date property
2067 */
2068 public function getAltNumber(string $key): string;
2069
2070 /**
2071 * Returns the list of internally available locales and already loaded custom locales.
2072 * (It will ignore custom translator dynamic loading.)
2073 *
2074 * @return array
2075 */
2076 public static function getAvailableLocales();
2077
2078 /**
2079 * Returns list of Language object for each available locale. This object allow you to get the ISO name, native
2080 * name, region and variant of the locale.
2081 *
2082 * @return Language[]
2083 */
2084 public static function getAvailableLocalesInfo();
2085
2086 /**
2087 * Returns list of calendar formats for ISO formatting.
2088 *
2089 * @param string|null $locale current locale used if null
2090 */
2091 public function getCalendarFormats(?string $locale = null): array;
2092
2093 public function getClock(): ?WrapperClock;
2094
2095 /**
2096 * Get the days of the week.
2097 */
2098 public static function getDays(): array;
2099
2100 /**
2101 * Return the number of days since the start of the week (using the current locale or the first parameter
2102 * if explicitly given).
2103 *
2104 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week,
2105 * if not provided, start of week is inferred from the locale
2106 * (Sunday for en_US, Monday for de_DE, etc.)
2107 */
2108 public function getDaysFromStartOfWeek(WeekDay|int|null $weekStartsAt = null): int;
2109
2110 /**
2111 * Get the fallback locale.
2112 *
2113 * @see https://symfony.com/doc/current/components/translation.html#fallback-locales
2114 */
2115 public static function getFallbackLocale(): ?string;
2116
2117 /**
2118 * List of replacements from date() format to isoFormat().
2119 */
2120 public static function getFormatsToIsoReplacements(): array;
2121
2122 /**
2123 * Return default humanDiff() options (merged flags as integer).
2124 */
2125 public static function getHumanDiffOptions(): int;
2126
2127 /**
2128 * Returns list of locale formats for ISO formatting.
2129 *
2130 * @param string|null $locale current locale used if null
2131 */
2132 public function getIsoFormats(?string $locale = null): array;
2133
2134 /**
2135 * Returns list of locale units for ISO formatting.
2136 */
2137 public static function getIsoUnits(): array;
2138
2139 /**
2140 * {@inheritdoc}
2141 */
2142 public static function getLastErrors(): array|false;
2143
2144 /**
2145 * Get the raw callable macro registered globally or locally for a given name.
2146 */
2147 public function getLocalMacro(string $name): ?callable;
2148
2149 /**
2150 * Get the translator of the current instance or the default if none set.
2151 */
2152 public function getLocalTranslator(): TranslatorInterface;
2153
2154 /**
2155 * Get the current translator locale.
2156 *
2157 * @return string
2158 */
2159 public static function getLocale(): string;
2160
2161 /**
2162 * Get the raw callable macro registered globally for a given name.
2163 */
2164 public static function getMacro(string $name): ?callable;
2165
2166 /**
2167 * get midday/noon hour
2168 *
2169 * @return int
2170 */
2171 public static function getMidDayAt();
2172
2173 /**
2174 * Returns the offset hour and minute formatted with +/- and a given separator (":" by default).
2175 * For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first
2176 * argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something
2177 * like "-12:00".
2178 *
2179 * @param string $separator string to place between hours and minutes (":" by default)
2180 */
2181 public function getOffsetString(string $separator = ':'): string;
2182
2183 /**
2184 * Returns a unit of the instance padded with 0 by default or any other string if specified.
2185 *
2186 * @param string $unit Carbon unit name
2187 * @param int $length Length of the output (2 by default)
2188 * @param string $padString String to use for padding ("0" by default)
2189 * @param int $padType Side(s) to pad (STR_PAD_LEFT by default)
2190 */
2191 public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = 0): string;
2192
2193 /**
2194 * Returns a timestamp rounded with the given precision (6 by default).
2195 *
2196 * @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)
2197 * @example getPreciseTimestamp(6) 1532087464437474
2198 * @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision)
2199 * @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision)
2200 * @example getPreciseTimestamp(3) 1532087464437 (millisecond precision)
2201 * @example getPreciseTimestamp(2) 153208746444 (1/100 second precision)
2202 * @example getPreciseTimestamp(1) 15320874644 (1/10 second precision)
2203 * @example getPreciseTimestamp(0) 1532087464 (second precision)
2204 * @example getPreciseTimestamp(-1) 153208746 (10 second precision)
2205 * @example getPreciseTimestamp(-2) 15320875 (100 second precision)
2206 *
2207 * @param int $precision
2208 *
2209 * @return float
2210 */
2211 public function getPreciseTimestamp($precision = 6): float;
2212
2213 /**
2214 * Returns current local settings.
2215 */
2216 public function getSettings(): array;
2217
2218 /**
2219 * Get the Carbon instance (real or mock) to be returned when a "now"
2220 * instance is created.
2221 *
2222 * @return Closure|self|null the current instance used for testing
2223 */
2224 public static function getTestNow(): Closure|self|null;
2225
2226 /**
2227 * Return a format from H:i to H:i:s.u according to given unit precision.
2228 *
2229 * @param string $unitPrecision "minute", "second", "millisecond" or "microsecond"
2230 */
2231 public static function getTimeFormatByPrecision(string $unitPrecision): string;
2232
2233 /**
2234 * Returns the timestamp with millisecond precision.
2235 *
2236 * @return int
2237 */
2238 public function getTimestampMs(): int;
2239
2240 /**
2241 * Get the translation of the current week day name (with context for languages with multiple forms).
2242 *
2243 * @param string|null $context whole format string
2244 * @param string $keySuffix "", "_short" or "_min"
2245 * @param string|null $defaultValue default value if translation missing
2246 */
2247 public function getTranslatedDayName(?string $context = null, string $keySuffix = '', ?string $defaultValue = null): string;
2248
2249 /**
2250 * Get the translation of the current abbreviated week day name (with context for languages with multiple forms).
2251 *
2252 * @param string|null $context whole format string
2253 */
2254 public function getTranslatedMinDayName(?string $context = null): string;
2255
2256 /**
2257 * Get the translation of the current month day name (with context for languages with multiple forms).
2258 *
2259 * @param string|null $context whole format string
2260 * @param string $keySuffix "" or "_short"
2261 * @param string|null $defaultValue default value if translation missing
2262 */
2263 public function getTranslatedMonthName(?string $context = null, string $keySuffix = '', ?string $defaultValue = null): string;
2264
2265 /**
2266 * Get the translation of the current short week day name (with context for languages with multiple forms).
2267 *
2268 * @param string|null $context whole format string
2269 */
2270 public function getTranslatedShortDayName(?string $context = null): string;
2271
2272 /**
2273 * Get the translation of the current short month day name (with context for languages with multiple forms).
2274 *
2275 * @param string|null $context whole format string
2276 */
2277 public function getTranslatedShortMonthName(?string $context = null): string;
2278
2279 /**
2280 * Returns raw translation message for a given key.
2281 *
2282 * @param string $key key to find
2283 * @param string|null $locale current locale used if null
2284 * @param string|null $default default value if translation returns the key
2285 * @param TranslatorInterface $translator an optional translator to use
2286 *
2287 * @return string
2288 */
2289 public function getTranslationMessage(string $key, ?string $locale = null, ?string $default = null, $translator = null);
2290
2291 /**
2292 * Returns raw translation message for a given key.
2293 *
2294 * @param TranslatorInterface|null $translator the translator to use
2295 * @param string $key key to find
2296 * @param string|null $locale current locale used if null
2297 * @param string|null $default default value if translation returns the key
2298 *
2299 * @return string|Closure|null
2300 */
2301 public static function getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null);
2302
2303 /**
2304 * Initialize the default translator instance if necessary.
2305 */
2306 public static function getTranslator(): TranslatorInterface;
2307
2308 /**
2309 * Get the last day of week.
2310 *
2311 * @param string $locale local to consider the last day of week.
2312 *
2313 * @return int
2314 */
2315 public static function getWeekEndsAt(?string $locale = null): int;
2316
2317 /**
2318 * Get the first day of week.
2319 *
2320 * @return int
2321 */
2322 public static function getWeekStartsAt(?string $locale = null): int;
2323
2324 /**
2325 * Get weekend days
2326 */
2327 public static function getWeekendDays(): array;
2328
2329 /**
2330 * Determines if the instance is greater (after) than another
2331 *
2332 * @example
2333 * ```
2334 * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:15'); // true
2335 * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false
2336 * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false
2337 * ```
2338 */
2339 public function greaterThan(DateTimeInterface|string $date): bool;
2340
2341 /**
2342 * Determines if the instance is greater (after) than or equal to another
2343 *
2344 * @example
2345 * ```
2346 * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:15'); // true
2347 * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true
2348 * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false
2349 * ```
2350 */
2351 public function greaterThanOrEqualTo(DateTimeInterface|string $date): bool;
2352
2353 /**
2354 * Determines if the instance is greater (after) than another
2355 *
2356 * @example
2357 * ```
2358 * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:15'); // true
2359 * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false
2360 * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false
2361 * ```
2362 *
2363 * @see greaterThan()
2364 */
2365 public function gt(DateTimeInterface|string $date): bool;
2366
2367 /**
2368 * Determines if the instance is greater (after) than or equal to another
2369 *
2370 * @example
2371 * ```
2372 * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:15'); // true
2373 * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true
2374 * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false
2375 * ```
2376 *
2377 * @see greaterThanOrEqualTo()
2378 */
2379 public function gte(DateTimeInterface|string $date): bool;
2380
2381 /**
2382 * Checks if the (date)time string is in a given format.
2383 *
2384 * @example
2385 * ```
2386 * Carbon::hasFormat('11:12:45', 'h:i:s'); // true
2387 * Carbon::hasFormat('13:12:45', 'h:i:s'); // false
2388 * ```
2389 */
2390 public static function hasFormat(string $date, string $format): bool;
2391
2392 /**
2393 * Checks if the (date)time string is in a given format.
2394 *
2395 * @example
2396 * ```
2397 * Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true
2398 * Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false
2399 * ```
2400 *
2401 * @param string $date
2402 * @param string $format
2403 *
2404 * @return bool
2405 */
2406 public static function hasFormatWithModifiers(?string $date, string $format): bool;
2407
2408 /**
2409 * Checks if macro is registered globally or locally.
2410 */
2411 public function hasLocalMacro(string $name): bool;
2412
2413 /**
2414 * Return true if the current instance has its own translator.
2415 */
2416 public function hasLocalTranslator(): bool;
2417
2418 /**
2419 * Checks if macro is registered globally.
2420 *
2421 * @param string $name
2422 *
2423 * @return bool
2424 */
2425 public static function hasMacro(string $name): bool;
2426
2427 /**
2428 * Determine if a time string will produce a relative date.
2429 *
2430 * @return bool true if time match a relative date, false if absolute or invalid time string
2431 */
2432 public static function hasRelativeKeywords(?string $time): bool;
2433
2434 /**
2435 * Determine if there is a valid test instance set. A valid test instance
2436 * is anything that is not null.
2437 *
2438 * @return bool true if there is a test instance, otherwise false
2439 */
2440 public static function hasTestNow(): bool;
2441
2442 /**
2443 * Create a Carbon instance from a DateTime one.
2444 */
2445 public static function instance(DateTimeInterface $date): static;
2446
2447 /**
2448 * Returns true if the current date matches the given string.
2449 *
2450 * @example
2451 * ```
2452 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true
2453 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false
2454 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true
2455 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true
2456 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true
2457 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true
2458 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true
2459 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true
2460 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true
2461 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false
2462 * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true
2463 * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true
2464 * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false
2465 * ```
2466 *
2467 * @param string $tester day name, month name, hour, date, etc. as string
2468 */
2469 public function is(WeekDay|Month|string $tester): bool;
2470
2471 /**
2472 * Determines if the instance is greater (after) than another
2473 *
2474 * @example
2475 * ```
2476 * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:15'); // true
2477 * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false
2478 * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false
2479 * ```
2480 *
2481 * @see greaterThan()
2482 */
2483 public function isAfter(DateTimeInterface|string $date): bool;
2484
2485 /**
2486 * Determines if the instance is less (before) than another
2487 *
2488 * @example
2489 * ```
2490 * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:15'); // false
2491 * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false
2492 * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true
2493 * ```
2494 *
2495 * @see lessThan()
2496 */
2497 public function isBefore(DateTimeInterface|string $date): bool;
2498
2499 /**
2500 * Determines if the instance is between two others
2501 *
2502 * @example
2503 * ```
2504 * Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true
2505 * Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false
2506 * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // true
2507 * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', false); // false
2508 * ```
2509 *
2510 * @param bool $equal Indicates if an equal to comparison should be done
2511 */
2512 public function isBetween(DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true): bool;
2513
2514 /**
2515 * Check if its the birthday. Compares the date/month values of the two dates.
2516 *
2517 * @example
2518 * ```
2519 * Carbon::now()->subYears(5)->isBirthday(); // true
2520 * Carbon::now()->subYears(5)->subDay()->isBirthday(); // false
2521 * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true
2522 * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false
2523 * ```
2524 *
2525 * @param DateTimeInterface|string|null $date The instance to compare with or null to use current day.
2526 *
2527 * @return bool
2528 */
2529 public function isBirthday(DateTimeInterface|string|null $date = null): bool;
2530
2531 /**
2532 * Determines if the instance is in the current unit given.
2533 *
2534 * @example
2535 * ```
2536 * Carbon::now()->isCurrentUnit('hour'); // true
2537 * Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false
2538 * ```
2539 *
2540 * @param string $unit The unit to test.
2541 *
2542 * @throws BadMethodCallException
2543 */
2544 public function isCurrentUnit(string $unit): bool;
2545
2546 /**
2547 * Checks if this day is a specific day of the week.
2548 *
2549 * @example
2550 * ```
2551 * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true
2552 * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false
2553 * Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true
2554 * Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false
2555 * ```
2556 *
2557 * @param int|string $dayOfWeek
2558 *
2559 * @return bool
2560 */
2561 public function isDayOfWeek($dayOfWeek): bool;
2562
2563 /**
2564 * Determines if the instance is end of century (last day by default but interval can be customized).
2565 */
2566 public function isEndOfCentury(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2567
2568 /**
2569 * Check if the instance is end of day.
2570 *
2571 * @example
2572 * ```
2573 * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true
2574 * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true
2575 * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true
2576 * Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false
2577 * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true
2578 * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false
2579 * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false
2580 * ```
2581 *
2582 * @param bool $checkMicroseconds check time at microseconds precision
2583 * @param Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval if an interval is specified it will be used as precision
2584 * for instance with "15 minutes", it checks if current date-time
2585 * is in the last 15 minutes of the day, with Unit::Hour, it
2586 * checks if it's in the last hour of the day.
2587 */
2588 public function isEndOfDay(Unit|DateInterval|Closure|CarbonConverterInterface|string|bool $checkMicroseconds = false, Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2589
2590 /**
2591 * Determines if the instance is end of decade (last day by default but interval can be customized).
2592 */
2593 public function isEndOfDecade(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2594
2595 /**
2596 * Determines if the instance is end of hour (last microsecond by default but interval can be customized).
2597 */
2598 public function isEndOfHour(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2599
2600 /**
2601 * Determines if the instance is end of millennium (last day by default but interval can be customized).
2602 */
2603 public function isEndOfMillennium(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2604
2605 /**
2606 * Determines if the instance is end of millisecond (last microsecond by default but interval can be customized).
2607 */
2608 public function isEndOfMillisecond(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2609
2610 /**
2611 * Determines if the instance is end of minute (last microsecond by default but interval can be customized).
2612 */
2613 public function isEndOfMinute(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2614
2615 /**
2616 * Determines if the instance is end of month (last day by default but interval can be customized).
2617 */
2618 public function isEndOfMonth(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2619
2620 /**
2621 * Determines if the instance is end of quarter (last day by default but interval can be customized).
2622 */
2623 public function isEndOfQuarter(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2624
2625 /**
2626 * Determines if the instance is end of second (last microsecond by default but interval can be customized).
2627 */
2628 public function isEndOfSecond(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2629
2630 /**
2631 * Returns true if the date was created using CarbonImmutable::endOfTime()
2632 *
2633 * @return bool
2634 */
2635 public function isEndOfTime(): bool;
2636
2637 /**
2638 * Check if the instance is end of a given unit (tolerating a given interval).
2639 *
2640 * @example
2641 * ```
2642 * // Check if a date-time is the last 15 minutes of the hour it's in
2643 * Carbon::parse('2019-02-28 20:13:00')->isEndOfUnit(Unit::Hour, '15 minutes'); // false
2644 * ```
2645 */
2646 public function isEndOfUnit(Unit $unit, Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null, mixed ...$params): bool;
2647
2648 /**
2649 * Determines if the instance is end of week (last day by default but interval can be customized).
2650 *
2651 * @example
2652 * ```
2653 * Carbon::parse('2024-08-31')->endOfWeek()->isEndOfWeek(); // true
2654 * Carbon::parse('2024-08-31')->isEndOfWeek(); // false
2655 * ```
2656 */
2657 public function isEndOfWeek(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null, WeekDay|int|null $weekEndsAt = null): bool;
2658
2659 /**
2660 * Determines if the instance is end of year (last day by default but interval can be customized).
2661 */
2662 public function isEndOfYear(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2663
2664 /**
2665 * Determines if the instance is in the future, ie. greater (after) than now.
2666 *
2667 * @example
2668 * ```
2669 * Carbon::now()->addHours(5)->isFuture(); // true
2670 * Carbon::now()->subHours(5)->isFuture(); // false
2671 * ```
2672 */
2673 public function isFuture(): bool;
2674
2675 /**
2676 * Returns true if the current class/instance is immutable.
2677 */
2678 public static function isImmutable(): bool;
2679
2680 /**
2681 * Check if today is the last day of the Month
2682 *
2683 * @example
2684 * ```
2685 * Carbon::parse('2019-02-28')->isLastOfMonth(); // true
2686 * Carbon::parse('2019-03-28')->isLastOfMonth(); // false
2687 * Carbon::parse('2019-03-30')->isLastOfMonth(); // false
2688 * Carbon::parse('2019-03-31')->isLastOfMonth(); // true
2689 * Carbon::parse('2019-04-30')->isLastOfMonth(); // true
2690 * ```
2691 */
2692 public function isLastOfMonth(): bool;
2693
2694 /**
2695 * Determines if the instance is a leap year.
2696 *
2697 * @example
2698 * ```
2699 * Carbon::parse('2020-01-01')->isLeapYear(); // true
2700 * Carbon::parse('2019-01-01')->isLeapYear(); // false
2701 * ```
2702 */
2703 public function isLeapYear(): bool;
2704
2705 /**
2706 * Determines if the instance is a long year (using ISO 8601 year).
2707 *
2708 * @example
2709 * ```
2710 * Carbon::parse('2015-01-01')->isLongIsoYear(); // true
2711 * Carbon::parse('2016-01-01')->isLongIsoYear(); // true
2712 * Carbon::parse('2016-01-03')->isLongIsoYear(); // false
2713 * Carbon::parse('2019-12-29')->isLongIsoYear(); // false
2714 * Carbon::parse('2019-12-30')->isLongIsoYear(); // true
2715 * ```
2716 *
2717 * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates
2718 */
2719 public function isLongIsoYear(): bool;
2720
2721 /**
2722 * Determines if the instance is a long year (using calendar year).
2723 *
2724 * ⚠️ This method completely ignores month and day to use the numeric year number,
2725 * it's not correct if the exact date matters. For instance as `2019-12-30` is already
2726 * in the first week of the 2020 year, if you want to know from this date if ISO week
2727 * year 2020 is a long year, use `isLongIsoYear` instead.
2728 *
2729 * @example
2730 * ```
2731 * Carbon::create(2015)->isLongYear(); // true
2732 * Carbon::create(2016)->isLongYear(); // false
2733 * ```
2734 *
2735 * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates
2736 */
2737 public function isLongYear(): bool;
2738
2739 /**
2740 * Check if the instance is midday.
2741 *
2742 * @example
2743 * ```
2744 * Carbon::parse('2019-02-28 11:59:59.999999')->isMidday(); // false
2745 * Carbon::parse('2019-02-28 12:00:00')->isMidday(); // true
2746 * Carbon::parse('2019-02-28 12:00:00.999999')->isMidday(); // true
2747 * Carbon::parse('2019-02-28 12:00:01')->isMidday(); // false
2748 * ```
2749 */
2750 public function isMidday(): bool;
2751
2752 /**
2753 * Check if the instance is start of day / midnight.
2754 *
2755 * @example
2756 * ```
2757 * Carbon::parse('2019-02-28 00:00:00')->isMidnight(); // true
2758 * Carbon::parse('2019-02-28 00:00:00.999999')->isMidnight(); // true
2759 * Carbon::parse('2019-02-28 00:00:01')->isMidnight(); // false
2760 * ```
2761 */
2762 public function isMidnight(): bool;
2763
2764 /**
2765 * Returns true if a property can be changed via setter.
2766 *
2767 * @param string $unit
2768 *
2769 * @return bool
2770 */
2771 public static function isModifiableUnit($unit): bool;
2772
2773 /**
2774 * Returns true if the current class/instance is mutable.
2775 */
2776 public static function isMutable(): bool;
2777
2778 /**
2779 * Determines if the instance is now or in the future, ie. greater (after) than or equal to now.
2780 *
2781 * @example
2782 * ```
2783 * Carbon::now()->isNowOrFuture(); // true
2784 * Carbon::now()->addHours(5)->isNowOrFuture(); // true
2785 * Carbon::now()->subHours(5)->isNowOrFuture(); // false
2786 * ```
2787 */
2788 public function isNowOrFuture(): bool;
2789
2790 /**
2791 * Determines if the instance is now or in the past, ie. less (before) than or equal to now.
2792 *
2793 * @example
2794 * ```
2795 * Carbon::now()->isNowOrPast(); // true
2796 * Carbon::now()->subHours(5)->isNowOrPast(); // true
2797 * Carbon::now()->addHours(5)->isNowOrPast(); // false
2798 * ```
2799 */
2800 public function isNowOrPast(): bool;
2801
2802 /**
2803 * Determines if the instance is in the past, ie. less (before) than now.
2804 *
2805 * @example
2806 * ```
2807 * Carbon::now()->subHours(5)->isPast(); // true
2808 * Carbon::now()->addHours(5)->isPast(); // false
2809 * ```
2810 */
2811 public function isPast(): bool;
2812
2813 /**
2814 * Compares the formatted values of the two dates.
2815 *
2816 * @example
2817 * ```
2818 * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true
2819 * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false
2820 * ```
2821 *
2822 * @param string $format date formats to compare.
2823 * @param DateTimeInterface|string $date instance to compare with or null to use current day.
2824 */
2825 public function isSameAs(string $format, DateTimeInterface|string $date): bool;
2826
2827 /**
2828 * Checks if the passed in date is in the same month as the instance´s month.
2829 *
2830 * @example
2831 * ```
2832 * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true
2833 * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false
2834 * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false
2835 * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true
2836 * ```
2837 *
2838 * @param DateTimeInterface|string $date The instance to compare with or null to use the current date.
2839 * @param bool $ofSameYear Check if it is the same month in the same year.
2840 *
2841 * @return bool
2842 */
2843 public function isSameMonth(DateTimeInterface|string $date, bool $ofSameYear = true): bool;
2844
2845 /**
2846 * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).
2847 *
2848 * @example
2849 * ```
2850 * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true
2851 * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false
2852 * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false
2853 * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true
2854 * ```
2855 *
2856 * @param DateTimeInterface|string $date The instance to compare with or null to use current day.
2857 * @param bool $ofSameYear Check if it is the same month in the same year.
2858 *
2859 * @return bool
2860 */
2861 public function isSameQuarter(DateTimeInterface|string $date, bool $ofSameYear = true): bool;
2862
2863 /**
2864 * Determines if the instance is in the current unit given.
2865 *
2866 * @example
2867 * ```
2868 * Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true
2869 * Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false
2870 * ```
2871 *
2872 * @param string $unit singular unit string
2873 * @param DateTimeInterface|string $date instance to compare with or null to use current day.
2874 *
2875 * @throws BadComparisonUnitException
2876 *
2877 * @return bool
2878 */
2879 public function isSameUnit(string $unit, DateTimeInterface|string $date): bool;
2880
2881 /**
2882 * Determines if the instance is start of century (first day by default but interval can be customized).
2883 */
2884 public function isStartOfCentury(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2885
2886 /**
2887 * Check if the instance is start of day / midnight.
2888 *
2889 * @example
2890 * ```
2891 * Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true
2892 * Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true
2893 * Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false
2894 * Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true
2895 * Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false
2896 * ```
2897 *
2898 * @param bool $checkMicroseconds check time at microseconds precision
2899 * @param Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval if an interval is specified it will be used as precision
2900 * for instance with "15 minutes", it checks if current date-time
2901 * is in the last 15 minutes of the day, with Unit::Hour, it
2902 * checks if it's in the last hour of the day.
2903 */
2904 public function isStartOfDay(Unit|DateInterval|Closure|CarbonConverterInterface|string|bool $checkMicroseconds = false, Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2905
2906 /**
2907 * Determines if the instance is start of decade (first day by default but interval can be customized).
2908 */
2909 public function isStartOfDecade(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2910
2911 /**
2912 * Determines if the instance is start of hour (first microsecond by default but interval can be customized).
2913 */
2914 public function isStartOfHour(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2915
2916 /**
2917 * Determines if the instance is start of millennium (first day by default but interval can be customized).
2918 */
2919 public function isStartOfMillennium(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2920
2921 /**
2922 * Determines if the instance is start of millisecond (first microsecond by default but interval can be customized).
2923 */
2924 public function isStartOfMillisecond(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2925
2926 /**
2927 * Determines if the instance is start of minute (first microsecond by default but interval can be customized).
2928 */
2929 public function isStartOfMinute(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2930
2931 /**
2932 * Determines if the instance is start of month (first day by default but interval can be customized).
2933 */
2934 public function isStartOfMonth(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2935
2936 /**
2937 * Determines if the instance is start of quarter (first day by default but interval can be customized).
2938 */
2939 public function isStartOfQuarter(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2940
2941 /**
2942 * Determines if the instance is start of second (first microsecond by default but interval can be customized).
2943 */
2944 public function isStartOfSecond(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2945
2946 /**
2947 * Returns true if the date was created using CarbonImmutable::startOfTime()
2948 *
2949 * @return bool
2950 */
2951 public function isStartOfTime(): bool;
2952
2953 /**
2954 * Check if the instance is start of a given unit (tolerating a given interval).
2955 *
2956 * @example
2957 * ```
2958 * // Check if a date-time is the first 15 minutes of the hour it's in
2959 * Carbon::parse('2019-02-28 20:13:00')->isStartOfUnit(Unit::Hour, '15 minutes'); // true
2960 * ```
2961 */
2962 public function isStartOfUnit(Unit $unit, Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null, mixed ...$params): bool;
2963
2964 /**
2965 * Determines if the instance is start of week (first day by default but interval can be customized).
2966 *
2967 * @example
2968 * ```
2969 * Carbon::parse('2024-08-31')->startOfWeek()->isStartOfWeek(); // true
2970 * Carbon::parse('2024-08-31')->isStartOfWeek(); // false
2971 * ```
2972 */
2973 public function isStartOfWeek(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null, WeekDay|int|null $weekStartsAt = null): bool;
2974
2975 /**
2976 * Determines if the instance is start of year (first day by default but interval can be customized).
2977 */
2978 public function isStartOfYear(Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null): bool;
2979
2980 /**
2981 * Returns true if the strict mode is globally in use, false else.
2982 * (It can be overridden in specific instances.)
2983 *
2984 * @return bool
2985 */
2986 public static function isStrictModeEnabled(): bool;
2987
2988 /**
2989 * Determines if the instance is today.
2990 *
2991 * @example
2992 * ```
2993 * Carbon::today()->isToday(); // true
2994 * Carbon::tomorrow()->isToday(); // false
2995 * ```
2996 */
2997 public function isToday(): bool;
2998
2999 /**
3000 * Determines if the instance is tomorrow.
3001 *
3002 * @example
3003 * ```
3004 * Carbon::tomorrow()->isTomorrow(); // true
3005 * Carbon::yesterday()->isTomorrow(); // false
3006 * ```
3007 */
3008 public function isTomorrow(): bool;
3009
3010 /**
3011 * Determines if the instance is a weekday.
3012 *
3013 * @example
3014 * ```
3015 * Carbon::parse('2019-07-14')->isWeekday(); // false
3016 * Carbon::parse('2019-07-15')->isWeekday(); // true
3017 * ```
3018 */
3019 public function isWeekday(): bool;
3020
3021 /**
3022 * Determines if the instance is a weekend day.
3023 *
3024 * @example
3025 * ```
3026 * Carbon::parse('2019-07-14')->isWeekend(); // true
3027 * Carbon::parse('2019-07-15')->isWeekend(); // false
3028 * ```
3029 */
3030 public function isWeekend(): bool;
3031
3032 /**
3033 * Determines if the instance is yesterday.
3034 *
3035 * @example
3036 * ```
3037 * Carbon::yesterday()->isYesterday(); // true
3038 * Carbon::tomorrow()->isYesterday(); // false
3039 * ```
3040 */
3041 public function isYesterday(): bool;
3042
3043 /**
3044 * Format in the current language using ISO replacement patterns.
3045 *
3046 * @param string|null $originalFormat provide context if a chunk has been passed alone
3047 */
3048 public function isoFormat(string $format, ?string $originalFormat = null): string;
3049
3050 /**
3051 * Get/set the week number using given first day of week and first
3052 * day of year included in the first week. Or use ISO format if no settings
3053 * given.
3054 *
3055 * @param int|null $week
3056 * @param int|null $dayOfWeek
3057 * @param int|null $dayOfYear
3058 *
3059 * @return int|static
3060 */
3061 public function isoWeek($week = null, $dayOfWeek = null, $dayOfYear = null);
3062
3063 /**
3064 * Set/get the week number of year using given first day of week and first
3065 * day of year included in the first week. Or use ISO format if no settings
3066 * given.
3067 *
3068 * @param int|null $year if null, act as a getter, if not null, set the year and return current instance.
3069 * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
3070 * @param int|null $dayOfYear first day of year included in the week #1
3071 *
3072 * @return int|static
3073 */
3074 public function isoWeekYear($year = null, $dayOfWeek = null, $dayOfYear = null);
3075
3076 /**
3077 * Get/set the ISO weekday from 1 (Monday) to 7 (Sunday).
3078 *
3079 * @param WeekDay|int|null $value new value for weekday if using as setter.
3080 */
3081 public function isoWeekday(WeekDay|int|null $value = null): static|int;
3082
3083 /**
3084 * Get the number of weeks of the current week-year using given first day of week and first
3085 * day of year included in the first week. Or use ISO format if no settings
3086 * given.
3087 *
3088 * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
3089 * @param int|null $dayOfYear first day of year included in the week #1
3090 *
3091 * @return int
3092 */
3093 public function isoWeeksInYear($dayOfWeek = null, $dayOfYear = null);
3094
3095 /**
3096 * Prepare the object for JSON serialization.
3097 */
3098 public function jsonSerialize(): mixed;
3099
3100 /**
3101 * Modify to the last occurrence of a given day of the week
3102 * in the current month. If no dayOfWeek is provided, modify to the
3103 * last day of the current month. Use the supplied constants
3104 * to indicate the desired dayOfWeek, ex. static::MONDAY.
3105 *
3106 * @param int|null $dayOfWeek
3107 *
3108 * @return static
3109 */
3110 public function lastOfMonth($dayOfWeek = null);
3111
3112 /**
3113 * Modify to the last occurrence of a given day of the week
3114 * in the current quarter. If no dayOfWeek is provided, modify to the
3115 * last day of the current quarter. Use the supplied constants
3116 * to indicate the desired dayOfWeek, ex. static::MONDAY.
3117 *
3118 * @param int|null $dayOfWeek day of the week default null
3119 *
3120 * @return static
3121 */
3122 public function lastOfQuarter($dayOfWeek = null);
3123
3124 /**
3125 * Modify to the last occurrence of a given day of the week
3126 * in the current year. If no dayOfWeek is provided, modify to the
3127 * last day of the current year. Use the supplied constants
3128 * to indicate the desired dayOfWeek, ex. static::MONDAY.
3129 *
3130 * @param int|null $dayOfWeek day of the week default null
3131 *
3132 * @return static
3133 */
3134 public function lastOfYear($dayOfWeek = null);
3135
3136 /**
3137 * Determines if the instance is less (before) than another
3138 *
3139 * @example
3140 * ```
3141 * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:15'); // false
3142 * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false
3143 * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true
3144 * ```
3145 */
3146 public function lessThan(DateTimeInterface|string $date): bool;
3147
3148 /**
3149 * Determines if the instance is less (before) or equal to another
3150 *
3151 * @example
3152 * ```
3153 * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:15'); // false
3154 * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true
3155 * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true
3156 * ```
3157 */
3158 public function lessThanOrEqualTo(DateTimeInterface|string $date): bool;
3159
3160 /**
3161 * Get/set the locale for the current instance.
3162 *
3163 * @param string|null $locale
3164 * @param string ...$fallbackLocales
3165 *
3166 * @return $this|string
3167 */
3168 public function locale(?string $locale = null, string ...$fallbackLocales): static|string;
3169
3170 /**
3171 * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow).
3172 * Support is considered enabled if the 3 words are translated in the given locale.
3173 *
3174 * @param string $locale locale ex. en
3175 *
3176 * @return bool
3177 */
3178 public static function localeHasDiffOneDayWords(string $locale): bool;
3179
3180 /**
3181 * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after).
3182 * Support is considered enabled if the 4 sentences are translated in the given locale.
3183 *
3184 * @param string $locale locale ex. en
3185 *
3186 * @return bool
3187 */
3188 public static function localeHasDiffSyntax(string $locale): bool;
3189
3190 /**
3191 * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow).
3192 * Support is considered enabled if the 2 words are translated in the given locale.
3193 *
3194 * @param string $locale locale ex. en
3195 *
3196 * @return bool
3197 */
3198 public static function localeHasDiffTwoDayWords(string $locale): bool;
3199
3200 /**
3201 * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X).
3202 * Support is considered enabled if the 4 sentences are translated in the given locale.
3203 *
3204 * @param string $locale locale ex. en
3205 *
3206 * @return bool
3207 */
3208 public static function localeHasPeriodSyntax($locale);
3209
3210 /**
3211 * Returns true if the given locale is internally supported and has short-units support.
3212 * Support is considered enabled if either year, day or hour has a short variant translated.
3213 *
3214 * @param string $locale locale ex. en
3215 *
3216 * @return bool
3217 */
3218 public static function localeHasShortUnits(string $locale): bool;
3219
3220 /**
3221 * Determines if the instance is less (before) than another
3222 *
3223 * @example
3224 * ```
3225 * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:15'); // false
3226 * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false
3227 * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true
3228 * ```
3229 *
3230 * @see lessThan()
3231 */
3232 public function lt(DateTimeInterface|string $date): bool;
3233
3234 /**
3235 * Determines if the instance is less (before) or equal to another
3236 *
3237 * @example
3238 * ```
3239 * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:15'); // false
3240 * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true
3241 * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true
3242 * ```
3243 *
3244 * @see lessThanOrEqualTo()
3245 */
3246 public function lte(DateTimeInterface|string $date): bool;
3247
3248 /**
3249 * Register a custom macro.
3250 *
3251 * Pass null macro to remove it.
3252 *
3253 * @example
3254 * ```
3255 * $userSettings = [
3256 * 'locale' => 'pt',
3257 * 'timezone' => 'America/Sao_Paulo',
3258 * ];
3259 * Carbon::macro('userFormat', function () use ($userSettings) {
3260 * return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar();
3261 * });
3262 * echo Carbon::yesterday()->hours(11)->userFormat();
3263 * ```
3264 *
3265 * @param-closure-this static $macro
3266 */
3267 public static function macro(string $name, ?callable $macro): void;
3268
3269 /**
3270 * Make a Carbon instance from given variable if possible.
3271 *
3272 * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals
3273 * and recurrences). Throw an exception for invalid format, but otherwise return null.
3274 *
3275 * @param mixed $var
3276 *
3277 * @throws InvalidFormatException
3278 *
3279 * @return static|null
3280 */
3281 public static function make($var, DateTimeZone|string|null $timezone = null): ?static;
3282
3283 /**
3284 * Get the maximum instance between a given instance (default now) and the current instance.
3285 *
3286 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date
3287 *
3288 * @return static
3289 */
3290 public function max($date = null);
3291
3292 /**
3293 * Get the maximum instance between a given instance (default now) and the current instance.
3294 *
3295 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date
3296 *
3297 * @see max()
3298 *
3299 * @return static
3300 */
3301 public function maximum($date = null);
3302
3303 /**
3304 * Return the meridiem of the current time in the current locale.
3305 *
3306 * @param bool $isLower if true, returns lowercase variant if available in the current locale.
3307 */
3308 public function meridiem(bool $isLower = false): string;
3309
3310 /**
3311 * Modify to midday, default to self::$midDayAt
3312 *
3313 * @return static
3314 */
3315 public function midDay();
3316
3317 /**
3318 * Get the minimum instance between a given instance (default now) and the current instance.
3319 *
3320 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date
3321 *
3322 * @return static
3323 */
3324 public function min($date = null);
3325
3326 /**
3327 * Get the minimum instance between a given instance (default now) and the current instance.
3328 *
3329 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date
3330 *
3331 * @see min()
3332 *
3333 * @return static
3334 */
3335 public function minimum($date = null);
3336
3337 /**
3338 * Mix another object into the class.
3339 *
3340 * @example
3341 * ```
3342 * Carbon::mixin(new class {
3343 * public function addMoon() {
3344 * return function () {
3345 * return $this->addDays(30);
3346 * };
3347 * }
3348 * public function subMoon() {
3349 * return function () {
3350 * return $this->subDays(30);
3351 * };
3352 * }
3353 * });
3354 * $fullMoon = Carbon::create('2018-12-22');
3355 * $nextFullMoon = $fullMoon->addMoon();
3356 * $blackMoon = Carbon::create('2019-01-06');
3357 * $previousBlackMoon = $blackMoon->subMoon();
3358 * echo "$nextFullMoon\n";
3359 * echo "$previousBlackMoon\n";
3360 * ```
3361 *
3362 * @throws ReflectionException
3363 */
3364 public static function mixin(object|string $mixin): void;
3365
3366 /**
3367 * Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else.
3368 *
3369 * @see https://php.net/manual/en/datetime.modify.php
3370 *
3371 * @return static
3372 */
3373 #[ReturnTypeWillChange]
3374 public function modify($modify);
3375
3376 /**
3377 * Determines if the instance is not equal to another
3378 *
3379 * @example
3380 * ```
3381 * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false
3382 * Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false
3383 * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true
3384 * ```
3385 *
3386 * @see notEqualTo()
3387 */
3388 public function ne(DateTimeInterface|string $date): bool;
3389
3390 /**
3391 * Modify to the next occurrence of a given modifier such as a day of
3392 * the week. If no modifier is provided, modify to the next occurrence
3393 * of the current day of the week. Use the supplied constants
3394 * to indicate the desired dayOfWeek, ex. static::MONDAY.
3395 *
3396 * @param string|int|null $modifier
3397 *
3398 * @return static
3399 */
3400 public function next($modifier = null);
3401
3402 /**
3403 * Go forward to the next weekday.
3404 *
3405 * @return static
3406 */
3407 public function nextWeekday();
3408
3409 /**
3410 * Go forward to the next weekend day.
3411 *
3412 * @return static
3413 */
3414 public function nextWeekendDay();
3415
3416 /**
3417 * Determines if the instance is not equal to another
3418 *
3419 * @example
3420 * ```
3421 * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false
3422 * Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false
3423 * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true
3424 * ```
3425 */
3426 public function notEqualTo(DateTimeInterface|string $date): bool;
3427
3428 /**
3429 * Get a Carbon instance for the current date and time.
3430 */
3431 public static function now(DateTimeZone|string|int|null $timezone = null): static;
3432
3433 /**
3434 * Returns a present instance in the same timezone.
3435 *
3436 * @return static
3437 */
3438 public function nowWithSameTz(): static;
3439
3440 /**
3441 * Modify to the given occurrence of a given day of the week
3442 * in the current month. If the calculated occurrence is outside the scope
3443 * of the current month, then return false and no modifications are made.
3444 * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
3445 *
3446 * @param int $nth
3447 * @param int $dayOfWeek
3448 *
3449 * @return mixed
3450 */
3451 public function nthOfMonth($nth, $dayOfWeek);
3452
3453 /**
3454 * Modify to the given occurrence of a given day of the week
3455 * in the current quarter. If the calculated occurrence is outside the scope
3456 * of the current quarter, then return false and no modifications are made.
3457 * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
3458 *
3459 * @param int $nth
3460 * @param int $dayOfWeek
3461 *
3462 * @return mixed
3463 */
3464 public function nthOfQuarter($nth, $dayOfWeek);
3465
3466 /**
3467 * Modify to the given occurrence of a given day of the week
3468 * in the current year. If the calculated occurrence is outside the scope
3469 * of the current year, then return false and no modifications are made.
3470 * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
3471 *
3472 * @param int $nth
3473 * @param int $dayOfWeek
3474 *
3475 * @return mixed
3476 */
3477 public function nthOfYear($nth, $dayOfWeek);
3478
3479 /**
3480 * Return a property with its ordinal.
3481 */
3482 public function ordinal(string $key, ?string $period = null): string;
3483
3484 /**
3485 * Create a carbon instance from a string.
3486 *
3487 * This is an alias for the constructor that allows better fluent syntax
3488 * as it allows you to do Carbon::parse('Monday next week')->fn() rather
3489 * than (new Carbon('Monday next week'))->fn().
3490 *
3491 * @throws InvalidFormatException
3492 */
3493 public static function parse(DateTimeInterface|WeekDay|Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null): static;
3494
3495 /**
3496 * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).
3497 *
3498 * @param string $time date/time string in the given language (may also contain English).
3499 * @param string|null $locale if locale is null or not specified, current global locale will be
3500 * used instead.
3501 * @param DateTimeZone|string|int|null $timezone optional timezone for the new instance.
3502 *
3503 * @throws InvalidFormatException
3504 */
3505 public static function parseFromLocale(string $time, ?string $locale = null, DateTimeZone|string|int|null $timezone = null): static;
3506
3507 /**
3508 * Returns standardized plural of a given singular/plural unit name (in English).
3509 */
3510 public static function pluralUnit(string $unit): string;
3511
3512 /**
3513 * Modify to the previous occurrence of a given modifier such as a day of
3514 * the week. If no dayOfWeek is provided, modify to the previous occurrence
3515 * of the current day of the week. Use the supplied constants
3516 * to indicate the desired dayOfWeek, ex. static::MONDAY.
3517 *
3518 * @param string|int|null $modifier
3519 *
3520 * @return static
3521 */
3522 public function previous($modifier = null);
3523
3524 /**
3525 * Go backward to the previous weekday.
3526 *
3527 * @return static
3528 */
3529 public function previousWeekday();
3530
3531 /**
3532 * Go backward to the previous weekend day.
3533 *
3534 * @return static
3535 */
3536 public function previousWeekendDay();
3537
3538 /**
3539 * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
3540 *
3541 * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date
3542 * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit
3543 * @param string|null $unit if specified, $interval must be an integer
3544 */
3545 public function range($end = null, $interval = null, $unit = null): CarbonPeriod;
3546
3547 /**
3548 * Call native PHP DateTime/DateTimeImmutable add() method.
3549 *
3550 * @param DateInterval $interval
3551 *
3552 * @return static
3553 */
3554 public function rawAdd(DateInterval $interval): static;
3555
3556 /**
3557 * Create a Carbon instance from a specific format.
3558 *
3559 * @param string $format Datetime format
3560 * @param string $time
3561 * @param DateTimeZone|string|int|null $timezone
3562 *
3563 * @throws InvalidFormatException
3564 *
3565 * @return static|null
3566 */
3567 public static function rawCreateFromFormat(string $format, string $time, $timezone = null): ?static;
3568
3569 /**
3570 * @see https://php.net/manual/en/datetime.format.php
3571 */
3572 public function rawFormat(string $format): string;
3573
3574 /**
3575 * Create a carbon instance from a string.
3576 *
3577 * This is an alias for the constructor that allows better fluent syntax
3578 * as it allows you to do Carbon::parse('Monday next week')->fn() rather
3579 * than (new Carbon('Monday next week'))->fn().
3580 *
3581 * @throws InvalidFormatException
3582 */
3583 public static function rawParse(DateTimeInterface|WeekDay|Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null): static;
3584
3585 /**
3586 * Call native PHP DateTime/DateTimeImmutable sub() method.
3587 */
3588 public function rawSub(DateInterval $interval): static;
3589
3590 /**
3591 * Remove all macros and generic macros.
3592 */
3593 public static function resetMacros(): void;
3594
3595 /**
3596 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3597 * You should rather use the ->settings() method.
3598 * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants
3599 * are available for quarters, years, decade, centuries, millennia (singular and plural forms).
3600 * @see settings
3601 *
3602 * Reset the month overflow behavior.
3603 *
3604 * @return void
3605 */
3606 public static function resetMonthsOverflow(): void;
3607
3608 /**
3609 * Reset the format used to the default when type juggling a Carbon instance to a string
3610 *
3611 * @return void
3612 */
3613 public static function resetToStringFormat(): void;
3614
3615 /**
3616 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3617 * You should rather use the ->settings() method.
3618 * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants
3619 * are available for quarters, years, decade, centuries, millennia (singular and plural forms).
3620 * @see settings
3621 *
3622 * Reset the month overflow behavior.
3623 *
3624 * @return void
3625 */
3626 public static function resetYearsOverflow(): void;
3627
3628 /**
3629 * Round the current instance second with given precision if specified.
3630 */
3631 public function round(DateInterval|string|int|float $precision = 1, callable|string $function = 'round'): static;
3632
3633 /**
3634 * Round the current instance at the given unit with given precision if specified and the given function.
3635 */
3636 public function roundUnit(string $unit, DateInterval|string|int|float $precision = 1, callable|string $function = 'round'): static;
3637
3638 /**
3639 * Round the current instance week.
3640 *
3641 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
3642 */
3643 public function roundWeek(WeekDay|int|null $weekStartsAt = null): static;
3644
3645 /**
3646 * The number of seconds since midnight.
3647 *
3648 * @return float
3649 */
3650 public function secondsSinceMidnight(): float;
3651
3652 /**
3653 * The number of seconds until 23:59:59.
3654 *
3655 * @return float
3656 */
3657 public function secondsUntilEndOfDay(): float;
3658
3659 /**
3660 * Return a serialized string of the instance.
3661 */
3662 public function serialize(): string;
3663
3664 /**
3665 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3666 * You should rather transform Carbon object before the serialization.
3667 *
3668 * JSON serialize all Carbon instances using the given callback.
3669 */
3670 public static function serializeUsing(callable|string|null $format): void;
3671
3672 /**
3673 * Set a part of the Carbon object.
3674 *
3675 * @throws ImmutableException|UnknownSetterException
3676 *
3677 * @return $this
3678 */
3679 public function set(Unit|array|string $name, DateTimeZone|Month|string|int|float|null $value = null): static;
3680
3681 /**
3682 * Set the date with gregorian year, month and day numbers.
3683 *
3684 * @see https://php.net/manual/en/datetime.setdate.php
3685 */
3686 public function setDate(int $year, int $month, int $day): static;
3687
3688 /**
3689 * Set the year, month, and date for this instance to that of the passed instance.
3690 */
3691 public function setDateFrom(DateTimeInterface|string $date): static;
3692
3693 /**
3694 * Set the date and time all together.
3695 */
3696 public function setDateTime(int $year, int $month, int $day, int $hour, int $minute, int $second = 0, int $microseconds = 0): static;
3697
3698 /**
3699 * Set the date and time for this instance to that of the passed instance.
3700 */
3701 public function setDateTimeFrom(DateTimeInterface|string $date): static;
3702
3703 /**
3704 * Set the day (keeping the current time) to the start of the week + the number of days passed as the first
3705 * parameter. First day of week is driven by the locale unless explicitly set with the second parameter.
3706 *
3707 * @param int $numberOfDays number of days to add after the start of the current week
3708 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week,
3709 * if not provided, start of week is inferred from the locale
3710 * (Sunday for en_US, Monday for de_DE, etc.)
3711 */
3712 public function setDaysFromStartOfWeek(int $numberOfDays, WeekDay|int|null $weekStartsAt = null): static;
3713
3714 /**
3715 * Set the fallback locale.
3716 *
3717 * @see https://symfony.com/doc/current/components/translation.html#fallback-locales
3718 *
3719 * @param string $locale
3720 */
3721 public static function setFallbackLocale(string $locale): void;
3722
3723 /**
3724 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3725 * You should rather use the ->settings() method.
3726 * @see settings
3727 */
3728 public static function setHumanDiffOptions(int $humanDiffOptions): void;
3729
3730 /**
3731 * Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
3732 *
3733 * @see https://php.net/manual/en/datetime.setisodate.php
3734 */
3735 public function setISODate(int $year, int $week, int $day = 1): static;
3736
3737 /**
3738 * Set the translator for the current instance.
3739 */
3740 public function setLocalTranslator(TranslatorInterface $translator);
3741
3742 /**
3743 * Set the current translator locale and indicate if the source locale file exists.
3744 * Pass 'auto' as locale to use the closest language to the current LC_TIME locale.
3745 *
3746 * @param string $locale locale ex. en
3747 */
3748 public static function setLocale(string $locale): void;
3749
3750 /**
3751 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3752 * You should rather consider mid-day is always 12pm, then if you need to test if it's an other
3753 * hour, test it explicitly:
3754 * $date->format('G') == 13
3755 * or to set explicitly to a given hour:
3756 * $date->setTime(13, 0, 0, 0)
3757 *
3758 * Set midday/noon hour
3759 *
3760 * @param int $hour midday hour
3761 *
3762 * @return void
3763 */
3764 public static function setMidDayAt($hour);
3765
3766 /**
3767 * Set a Carbon instance (real or mock) to be returned when a "now"
3768 * instance is created. The provided instance will be returned
3769 * specifically under the following conditions:
3770 * - A call to the static now() method, ex. Carbon::now()
3771 * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
3772 * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
3773 * - When a string containing the desired time is passed to Carbon::parse().
3774 *
3775 * Note the timezone parameter was left out of the examples above and
3776 * has no affect as the mock value will be returned regardless of its value.
3777 *
3778 * Only the moment is mocked with setTestNow(), the timezone will still be the one passed
3779 * as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()).
3780 *
3781 * To clear the test instance call this method using the default
3782 * parameter of null.
3783 *
3784 * /!\ Use this method for unit tests only.
3785 *
3786 * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
3787 */
3788 public static function setTestNow(mixed $testNow = null): void;
3789
3790 /**
3791 * Set a Carbon instance (real or mock) to be returned when a "now"
3792 * instance is created. The provided instance will be returned
3793 * specifically under the following conditions:
3794 * - A call to the static now() method, ex. Carbon::now()
3795 * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
3796 * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
3797 * - When a string containing the desired time is passed to Carbon::parse().
3798 *
3799 * It will also align default timezone (e.g. call date_default_timezone_set()) with
3800 * the second argument or if null, with the timezone of the given date object.
3801 *
3802 * To clear the test instance call this method using the default
3803 * parameter of null.
3804 *
3805 * /!\ Use this method for unit tests only.
3806 *
3807 * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
3808 */
3809 public static function setTestNowAndTimezone($testNow = null, $timezone = null): void;
3810
3811 /**
3812 * Resets the current time of the DateTime object to a different time.
3813 *
3814 * @see https://php.net/manual/en/datetime.settime.php
3815 */
3816 public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0): static;
3817
3818 /**
3819 * Set the hour, minute, second and microseconds for this instance to that of the passed instance.
3820 */
3821 public function setTimeFrom(DateTimeInterface|string $date): static;
3822
3823 /**
3824 * Set the time by time string.
3825 */
3826 public function setTimeFromTimeString(string $time): static;
3827
3828 /**
3829 * Set the instance's timestamp.
3830 *
3831 * Timestamp input can be given as int, float or a string containing one or more numbers.
3832 */
3833 public function setTimestamp(string|int|float $timestamp): static;
3834
3835 /**
3836 * Set the instance's timezone from a string or object.
3837 */
3838 public function setTimezone(DateTimeZone|string|int $timeZone): static;
3839
3840 /**
3841 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3842 * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and
3843 * use other method or custom format passed to format() method if you need to dump another string
3844 * format.
3845 *
3846 * Set the default format used when type juggling a Carbon instance to a string.
3847 *
3848 * @param string|Closure|null $format
3849 *
3850 * @return void
3851 */
3852 public static function setToStringFormat(Closure|string|null $format): void;
3853
3854 /**
3855 * Set the default translator instance to use.
3856 *
3857 * @param TranslatorInterface $translator
3858 *
3859 * @return void
3860 */
3861 public static function setTranslator(TranslatorInterface $translator): void;
3862
3863 /**
3864 * Set specified unit to new given value.
3865 *
3866 * @param string $unit year, month, day, hour, minute, second or microsecond
3867 * @param Month|int $value new value for given unit
3868 */
3869 public function setUnit(string $unit, Month|int|float|null $value = null): static;
3870
3871 /**
3872 * Set any unit to a new value without overflowing current other unit given.
3873 *
3874 * @param string $valueUnit unit name to modify
3875 * @param int $value new value for the input unit
3876 * @param string $overflowUnit unit name to not overflow
3877 */
3878 public function setUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit): static;
3879
3880 /**
3881 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
3882 * You should rather consider week-end is always saturday and sunday, and if you have some custom
3883 * week-end days to handle, give to those days an other name and create a macro for them:
3884 *
3885 * ```
3886 * Carbon::macro('isDayOff', function ($date) {
3887 * return $date->isSunday() || $date->isMonday();
3888 * });
3889 * Carbon::macro('isNotDayOff', function ($date) {
3890 * return !$date->isDayOff();
3891 * });
3892 * if ($someDate->isDayOff()) ...
3893 * if ($someDate->isNotDayOff()) ...
3894 * // Add 5 not-off days
3895 * $count = 5;
3896 * while ($someDate->isDayOff() || ($count-- > 0)) {
3897 * $someDate->addDay();
3898 * }
3899 * ```
3900 *
3901 * Set weekend days
3902 */
3903 public static function setWeekendDays(array $days): void;
3904
3905 /**
3906 * Set specific options.
3907 * - strictMode: true|false|null
3908 * - monthOverflow: true|false|null
3909 * - yearOverflow: true|false|null
3910 * - humanDiffOptions: int|null
3911 * - toStringFormat: string|Closure|null
3912 * - toJsonFormat: string|Closure|null
3913 * - locale: string|null
3914 * - timezone: \DateTimeZone|string|int|null
3915 * - macros: array|null
3916 * - genericMacros: array|null
3917 *
3918 * @param array $settings
3919 *
3920 * @return $this|static
3921 */
3922 public function settings(array $settings): static;
3923
3924 /**
3925 * Set the instance's timezone from a string or object and add/subtract the offset difference.
3926 */
3927 public function shiftTimezone(DateTimeZone|string $value): static;
3928
3929 /**
3930 * Get the month overflow global behavior (can be overridden in specific instances).
3931 *
3932 * @return bool
3933 */
3934 public static function shouldOverflowMonths(): bool;
3935
3936 /**
3937 * Get the month overflow global behavior (can be overridden in specific instances).
3938 *
3939 * @return bool
3940 */
3941 public static function shouldOverflowYears(): bool;
3942
3943 /**
3944 * @alias diffForHumans
3945 *
3946 * Get the difference in a human readable format in the current locale from current instance to an other
3947 * instance given (or now if null given).
3948 */
3949 public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null);
3950
3951 /**
3952 * Returns standardized singular of a given singular/plural unit name (in English).
3953 */
3954 public static function singularUnit(string $unit): string;
3955
3956 public static function sleep(int|float $seconds): void;
3957
3958 /**
3959 * Modify to start of current given unit.
3960 *
3961 * @example
3962 * ```
3963 * echo Carbon::parse('2018-07-25 12:45:16.334455')
3964 * ->startOf(Unit::Month)
3965 * ->endOf(Unit::Week, Carbon::FRIDAY);
3966 * ```
3967 */
3968 public function startOf(Unit|string $unit, mixed ...$params): static;
3969
3970 /**
3971 * Resets the date to the first day of the century and the time to 00:00:00
3972 *
3973 * @example
3974 * ```
3975 * echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury();
3976 * ```
3977 *
3978 * @return static
3979 */
3980 public function startOfCentury();
3981
3982 /**
3983 * Resets the time to 00:00:00 start of day
3984 *
3985 * @example
3986 * ```
3987 * echo Carbon::parse('2018-07-25 12:45:16')->startOfDay();
3988 * ```
3989 *
3990 * @return static
3991 */
3992 public function startOfDay();
3993
3994 /**
3995 * Resets the date to the first day of the decade and the time to 00:00:00
3996 *
3997 * @example
3998 * ```
3999 * echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade();
4000 * ```
4001 *
4002 * @return static
4003 */
4004 public function startOfDecade();
4005
4006 /**
4007 * Modify to start of current hour, minutes and seconds become 0
4008 *
4009 * @example
4010 * ```
4011 * echo Carbon::parse('2018-07-25 12:45:16')->startOfHour();
4012 * ```
4013 */
4014 public function startOfHour(): static;
4015
4016 /**
4017 * Resets the date to the first day of the millennium and the time to 00:00:00
4018 *
4019 * @example
4020 * ```
4021 * echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium();
4022 * ```
4023 *
4024 * @return static
4025 */
4026 public function startOfMillennium();
4027
4028 /**
4029 * Modify to start of current millisecond, microseconds such as 12345 become 123000
4030 *
4031 * @example
4032 * ```
4033 * echo Carbon::parse('2018-07-25 12:45:16.334455')
4034 * ->startOfSecond()
4035 * ->format('H:i:s.u');
4036 * ```
4037 */
4038 public function startOfMillisecond(): static;
4039
4040 /**
4041 * Modify to start of current minute, seconds become 0
4042 *
4043 * @example
4044 * ```
4045 * echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute();
4046 * ```
4047 */
4048 public function startOfMinute(): static;
4049
4050 /**
4051 * Resets the date to the first day of the month and the time to 00:00:00
4052 *
4053 * @example
4054 * ```
4055 * echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth();
4056 * ```
4057 *
4058 * @return static
4059 */
4060 public function startOfMonth();
4061
4062 /**
4063 * Resets the date to the first day of the quarter and the time to 00:00:00
4064 *
4065 * @example
4066 * ```
4067 * echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter();
4068 * ```
4069 *
4070 * @return static
4071 */
4072 public function startOfQuarter();
4073
4074 /**
4075 * Modify to start of current second, microseconds become 0
4076 *
4077 * @example
4078 * ```
4079 * echo Carbon::parse('2018-07-25 12:45:16.334455')
4080 * ->startOfSecond()
4081 * ->format('H:i:s.u');
4082 * ```
4083 */
4084 public function startOfSecond(): static;
4085
4086 /**
4087 * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00
4088 *
4089 * @example
4090 * ```
4091 * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n";
4092 * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n";
4093 * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n";
4094 * ```
4095 *
4096 * @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
4097 *
4098 * @return static
4099 */
4100 public function startOfWeek(WeekDay|int|null $weekStartsAt = null): static;
4101
4102 /**
4103 * Resets the date to the first day of the year and the time to 00:00:00
4104 *
4105 * @example
4106 * ```
4107 * echo Carbon::parse('2018-07-25 12:45:16')->startOfYear();
4108 * ```
4109 *
4110 * @return static
4111 */
4112 public function startOfYear();
4113
4114 /**
4115 * Subtract given units or interval to the current instance.
4116 *
4117 * @example $date->sub('hour', 3)
4118 * @example $date->sub(15, 'days')
4119 * @example $date->sub(CarbonInterval::days(4))
4120 *
4121 * @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
4122 * @param Unit|int|float|string $value
4123 * @param bool|null $overflow
4124 *
4125 * @return static
4126 */
4127 #[ReturnTypeWillChange]
4128 public function sub($unit, $value = 1, ?bool $overflow = null): static;
4129
4130 /**
4131 * @deprecated Prefer to use add subUTCUnit() which more accurately defines what it's doing.
4132 *
4133 * Subtract seconds to the instance using timestamp. Positive $value travels
4134 * into the past while negative $value travels forward.
4135 *
4136 * @param string $unit
4137 * @param int $value
4138 *
4139 * @return static
4140 */
4141 public function subRealUnit($unit, $value = 1): static;
4142
4143 /**
4144 * Subtract seconds to the instance using timestamp. Positive $value travels
4145 * into the past while negative $value travels forward.
4146 *
4147 * @param string $unit
4148 * @param int $value
4149 *
4150 * @return static
4151 */
4152 public function subUTCUnit($unit, $value = 1): static;
4153
4154 /**
4155 * Subtract given units to the current instance.
4156 */
4157 public function subUnit(Unit|string $unit, $value = 1, ?bool $overflow = null): static;
4158
4159 /**
4160 * Subtract any unit to a new value without overflowing current other unit given.
4161 *
4162 * @param string $valueUnit unit name to modify
4163 * @param int $value amount to subtract to the input unit
4164 * @param string $overflowUnit unit name to not overflow
4165 */
4166 public function subUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit): static;
4167
4168 /**
4169 * Subtract given units or interval to the current instance.
4170 *
4171 * @see sub()
4172 *
4173 * @param Unit|int|string|DateInterval $unit
4174 * @param Unit|int|float|string $value
4175 * @param bool|null $overflow
4176 *
4177 * @return static
4178 */
4179 public function subtract($unit, $value = 1, ?bool $overflow = null): static;
4180
4181 /**
4182 * Get the difference in a human-readable format in the current locale from current instance to another
4183 * instance given (or now if null given).
4184 *
4185 * @return string
4186 */
4187 public function timespan($other = null, $timezone = null): string;
4188
4189 /**
4190 * Set the instance's timestamp.
4191 *
4192 * Timestamp input can be given as int, float or a string containing one or more numbers.
4193 */
4194 public function timestamp(string|int|float $timestamp): static;
4195
4196 /**
4197 * @alias setTimezone
4198 */
4199 public function timezone(DateTimeZone|string|int $value): static;
4200
4201 /**
4202 * Get the difference in a human readable format in the current locale from an other
4203 * instance given (or now if null given) to current instance.
4204 *
4205 * When comparing a value in the past to default now:
4206 * 1 hour from now
4207 * 5 months from now
4208 *
4209 * When comparing a value in the future to default now:
4210 * 1 hour ago
4211 * 5 months ago
4212 *
4213 * When comparing a value in the past to another value:
4214 * 1 hour after
4215 * 5 months after
4216 *
4217 * When comparing a value in the future to another value:
4218 * 1 hour before
4219 * 5 months before
4220 *
4221 * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
4222 * if null passed, now will be used as comparison reference;
4223 * if any other type, it will be converted to date and used as reference.
4224 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
4225 * - 'syntax' entry (see below)
4226 * - 'short' entry (see below)
4227 * - 'parts' entry (see below)
4228 * - 'options' entry (see below)
4229 * - 'join' entry determines how to join multiple parts of the string
4230 * ` - if $join is a string, it's used as a joiner glue
4231 * ` - if $join is a callable/closure, it get the list of string and should return a string
4232 * ` - if $join is an array, the first item will be the default glue, and the second item
4233 * ` will be used instead of the glue for the last item
4234 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
4235 * ` - if $join is missing, a space will be used as glue
4236 * - 'other' entry (see above)
4237 * if int passed, it add modifiers:
4238 * Possible values:
4239 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
4240 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
4241 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
4242 * Default value: CarbonInterface::DIFF_ABSOLUTE
4243 * @param bool $short displays short format of time units
4244 * @param int $parts maximum number of parts to display (default value: 1: single unit)
4245 * @param int $options human diff options
4246 *
4247 * @return string
4248 */
4249 public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null);
4250
4251 /**
4252 * Get default array representation.
4253 *
4254 * @example
4255 * ```
4256 * var_dump(Carbon::now()->toArray());
4257 * ```
4258 */
4259 public function toArray(): array;
4260
4261 /**
4262 * Format the instance as ATOM
4263 *
4264 * @example
4265 * ```
4266 * echo Carbon::now()->toAtomString();
4267 * ```
4268 */
4269 public function toAtomString(): string;
4270
4271 /**
4272 * Format the instance as COOKIE
4273 *
4274 * @example
4275 * ```
4276 * echo Carbon::now()->toCookieString();
4277 * ```
4278 */
4279 public function toCookieString(): string;
4280
4281 /**
4282 * @alias toDateTime
4283 *
4284 * Return native DateTime PHP object matching the current instance.
4285 *
4286 * @example
4287 * ```
4288 * var_dump(Carbon::now()->toDate());
4289 * ```
4290 */
4291 public function toDate(): DateTime;
4292
4293 /**
4294 * Format the instance as date
4295 *
4296 * @example
4297 * ```
4298 * echo Carbon::now()->toDateString();
4299 * ```
4300 */
4301 public function toDateString(): string;
4302
4303 /**
4304 * Return native DateTime PHP object matching the current instance.
4305 *
4306 * @example
4307 * ```
4308 * var_dump(Carbon::now()->toDateTime());
4309 * ```
4310 */
4311 public function toDateTime(): DateTime;
4312
4313 /**
4314 * Return native toDateTimeImmutable PHP object matching the current instance.
4315 *
4316 * @example
4317 * ```
4318 * var_dump(Carbon::now()->toDateTimeImmutable());
4319 * ```
4320 */
4321 public function toDateTimeImmutable(): DateTimeImmutable;
4322
4323 /**
4324 * Format the instance as date and time T-separated with no timezone
4325 *
4326 * @example
4327 * ```
4328 * echo Carbon::now()->toDateTimeLocalString();
4329 * echo "\n";
4330 * echo Carbon::now()->toDateTimeLocalString('minute'); // You can specify precision among: minute, second, millisecond and microsecond
4331 * ```
4332 */
4333 public function toDateTimeLocalString(string $unitPrecision = 'second'): string;
4334
4335 /**
4336 * Format the instance as date and time
4337 *
4338 * @example
4339 * ```
4340 * echo Carbon::now()->toDateTimeString();
4341 * ```
4342 */
4343 public function toDateTimeString(string $unitPrecision = 'second'): string;
4344
4345 /**
4346 * Format the instance with day, date and time
4347 *
4348 * @example
4349 * ```
4350 * echo Carbon::now()->toDayDateTimeString();
4351 * ```
4352 */
4353 public function toDayDateTimeString(): string;
4354
4355 /**
4356 * Format the instance as a readable date
4357 *
4358 * @example
4359 * ```
4360 * echo Carbon::now()->toFormattedDateString();
4361 * ```
4362 */
4363 public function toFormattedDateString(): string;
4364
4365 /**
4366 * Format the instance with the day, and a readable date
4367 *
4368 * @example
4369 * ```
4370 * echo Carbon::now()->toFormattedDayDateString();
4371 * ```
4372 */
4373 public function toFormattedDayDateString(): string;
4374
4375 /**
4376 * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept:
4377 * 1977-04-22T01:00:00-05:00).
4378 *
4379 * @example
4380 * ```
4381 * echo Carbon::now('America/Toronto')->toISOString() . "\n";
4382 * echo Carbon::now('America/Toronto')->toISOString(true) . "\n";
4383 * ```
4384 *
4385 * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC.
4386 */
4387 public function toISOString(bool $keepOffset = false): ?string;
4388
4389 /**
4390 * Return a immutable copy of the instance.
4391 *
4392 * @return CarbonImmutable
4393 */
4394 public function toImmutable();
4395
4396 /**
4397 * Format the instance as ISO8601
4398 *
4399 * @example
4400 * ```
4401 * echo Carbon::now()->toIso8601String();
4402 * ```
4403 */
4404 public function toIso8601String(): string;
4405
4406 /**
4407 * Convert the instance to UTC and return as Zulu ISO8601
4408 *
4409 * @example
4410 * ```
4411 * echo Carbon::now()->toIso8601ZuluString();
4412 * ```
4413 */
4414 public function toIso8601ZuluString(string $unitPrecision = 'second'): string;
4415
4416 /**
4417 * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.
4418 *
4419 * @example
4420 * ```
4421 * echo Carbon::now('America/Toronto')->toJSON();
4422 * ```
4423 */
4424 public function toJSON(): ?string;
4425
4426 /**
4427 * Return a mutable copy of the instance.
4428 *
4429 * @return Carbon
4430 */
4431 public function toMutable();
4432
4433 /**
4434 * Get the difference in a human readable format in the current locale from an other
4435 * instance given to now
4436 *
4437 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
4438 * - 'syntax' entry (see below)
4439 * - 'short' entry (see below)
4440 * - 'parts' entry (see below)
4441 * - 'options' entry (see below)
4442 * - 'join' entry determines how to join multiple parts of the string
4443 * ` - if $join is a string, it's used as a joiner glue
4444 * ` - if $join is a callable/closure, it get the list of string and should return a string
4445 * ` - if $join is an array, the first item will be the default glue, and the second item
4446 * ` will be used instead of the glue for the last item
4447 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
4448 * ` - if $join is missing, a space will be used as glue
4449 * if int passed, it add modifiers:
4450 * Possible values:
4451 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
4452 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
4453 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
4454 * Default value: CarbonInterface::DIFF_ABSOLUTE
4455 * @param bool $short displays short format of time units
4456 * @param int $parts maximum number of parts to display (default value: 1: single part)
4457 * @param int $options human diff options
4458 *
4459 * @return string
4460 */
4461 public function toNow($syntax = null, $short = false, $parts = 1, $options = null);
4462
4463 /**
4464 * Get default object representation.
4465 *
4466 * @example
4467 * ```
4468 * var_dump(Carbon::now()->toObject());
4469 * ```
4470 */
4471 public function toObject(): object;
4472
4473 /**
4474 * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
4475 *
4476 * @param \DateTimeInterface|Carbon|CarbonImmutable|int|null $end period end date or recurrences count if int
4477 * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit
4478 * @param string|null $unit if specified, $interval must be an integer
4479 */
4480 public function toPeriod($end = null, $interval = null, $unit = null): CarbonPeriod;
4481
4482 /**
4483 * Format the instance as RFC1036
4484 *
4485 * @example
4486 * ```
4487 * echo Carbon::now()->toRfc1036String();
4488 * ```
4489 */
4490 public function toRfc1036String(): string;
4491
4492 /**
4493 * Format the instance as RFC1123
4494 *
4495 * @example
4496 * ```
4497 * echo Carbon::now()->toRfc1123String();
4498 * ```
4499 */
4500 public function toRfc1123String(): string;
4501
4502 /**
4503 * Format the instance as RFC2822
4504 *
4505 * @example
4506 * ```
4507 * echo Carbon::now()->toRfc2822String();
4508 * ```
4509 */
4510 public function toRfc2822String(): string;
4511
4512 /**
4513 * Format the instance as RFC3339.
4514 *
4515 * @example
4516 * ```
4517 * echo Carbon::now()->toRfc3339String() . "\n";
4518 * echo Carbon::now()->toRfc3339String(true) . "\n";
4519 * ```
4520 */
4521 public function toRfc3339String(bool $extended = false): string;
4522
4523 /**
4524 * Format the instance as RFC7231
4525 *
4526 * @example
4527 * ```
4528 * echo Carbon::now()->toRfc7231String();
4529 * ```
4530 */
4531 public function toRfc7231String(): string;
4532
4533 /**
4534 * Format the instance as RFC822
4535 *
4536 * @example
4537 * ```
4538 * echo Carbon::now()->toRfc822String();
4539 * ```
4540 */
4541 public function toRfc822String(): string;
4542
4543 /**
4544 * Format the instance as RFC850
4545 *
4546 * @example
4547 * ```
4548 * echo Carbon::now()->toRfc850String();
4549 * ```
4550 */
4551 public function toRfc850String(): string;
4552
4553 /**
4554 * Format the instance as RSS
4555 *
4556 * @example
4557 * ```
4558 * echo Carbon::now()->toRssString();
4559 * ```
4560 */
4561 public function toRssString(): string;
4562
4563 /**
4564 * Returns english human-readable complete date string.
4565 *
4566 * @example
4567 * ```
4568 * echo Carbon::now()->toString();
4569 * ```
4570 */
4571 public function toString(): string;
4572
4573 /**
4574 * Format the instance as time
4575 *
4576 * @example
4577 * ```
4578 * echo Carbon::now()->toTimeString();
4579 * ```
4580 */
4581 public function toTimeString(string $unitPrecision = 'second'): string;
4582
4583 /**
4584 * Format the instance as W3C
4585 *
4586 * @example
4587 * ```
4588 * echo Carbon::now()->toW3cString();
4589 * ```
4590 */
4591 public function toW3cString(): string;
4592
4593 /**
4594 * Create a Carbon instance for today.
4595 */
4596 public static function today(DateTimeZone|string|int|null $timezone = null): static;
4597
4598 /**
4599 * Create a Carbon instance for tomorrow.
4600 */
4601 public static function tomorrow(DateTimeZone|string|int|null $timezone = null): static;
4602
4603 /**
4604 * Translate using translation string or callback available.
4605 *
4606 * @param string $key key to find
4607 * @param array $parameters replacement parameters
4608 * @param string|int|float|null $number number if plural
4609 * @param TranslatorInterface|null $translator an optional translator to use
4610 * @param bool $altNumbers pass true to use alternative numbers
4611 *
4612 * @return string
4613 */
4614 public function translate(string $key, array $parameters = [], string|int|float|null $number = null, ?TranslatorInterface $translator = null, bool $altNumbers = false): string;
4615
4616 /**
4617 * Returns the alternative number for a given integer if available in the current locale.
4618 *
4619 * @param int $number
4620 *
4621 * @return string
4622 */
4623 public function translateNumber(int $number): string;
4624
4625 /**
4626 * Translate a time string from a locale to an other.
4627 *
4628 * @param string $timeString date/time/duration string to translate (may also contain English)
4629 * @param string|null $from input locale of the $timeString parameter (`Carbon::getLocale()` by default)
4630 * @param string|null $to output locale of the result returned (`"en"` by default)
4631 * @param int $mode specify what to translate with options:
4632 * - self::TRANSLATE_ALL (default)
4633 * - CarbonInterface::TRANSLATE_MONTHS
4634 * - CarbonInterface::TRANSLATE_DAYS
4635 * - CarbonInterface::TRANSLATE_UNITS
4636 * - CarbonInterface::TRANSLATE_MERIDIEM
4637 * You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS
4638 *
4639 * @return string
4640 */
4641 public static function translateTimeString(string $timeString, ?string $from = null, ?string $to = null, int $mode = self::TRANSLATE_ALL): string;
4642
4643 /**
4644 * Translate a time string from the current locale (`$date->locale()`) to another one.
4645 *
4646 * @param string $timeString time string to translate
4647 * @param string|null $to output locale of the result returned ("en" by default)
4648 *
4649 * @return string
4650 */
4651 public function translateTimeStringTo(string $timeString, ?string $to = null): string;
4652
4653 /**
4654 * Translate using translation string or callback available.
4655 *
4656 * @param TranslatorInterface $translator an optional translator to use
4657 * @param string $key key to find
4658 * @param array $parameters replacement parameters
4659 * @param int|float|null $number number if plural
4660 *
4661 * @return string
4662 */
4663 public static function translateWith(TranslatorInterface $translator, string $key, array $parameters = [], $number = null): string;
4664
4665 /**
4666 * Format as ->format() do (using date replacements patterns from https://php.net/manual/en/function.date.php)
4667 * but translate words whenever possible (months, day names, etc.) using the current locale.
4668 */
4669 public function translatedFormat(string $format): string;
4670
4671 /**
4672 * Set the timezone or returns the timezone name if no arguments passed.
4673 *
4674 * @return ($value is null ? string : static)
4675 */
4676 public function tz(DateTimeZone|string|int|null $value = null): static|string;
4677
4678 /**
4679 * @alias getTimestamp
4680 *
4681 * Returns the UNIX timestamp for the current date.
4682 *
4683 * @return int
4684 */
4685 public function unix(): int;
4686
4687 /**
4688 * @alias to
4689 *
4690 * Get the difference in a human readable format in the current locale from an other
4691 * instance given (or now if null given) to current instance.
4692 *
4693 * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
4694 * if null passed, now will be used as comparison reference;
4695 * if any other type, it will be converted to date and used as reference.
4696 * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
4697 * - 'syntax' entry (see below)
4698 * - 'short' entry (see below)
4699 * - 'parts' entry (see below)
4700 * - 'options' entry (see below)
4701 * - 'join' entry determines how to join multiple parts of the string
4702 * ` - if $join is a string, it's used as a joiner glue
4703 * ` - if $join is a callable/closure, it get the list of string and should return a string
4704 * ` - if $join is an array, the first item will be the default glue, and the second item
4705 * ` will be used instead of the glue for the last item
4706 * ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
4707 * ` - if $join is missing, a space will be used as glue
4708 * - 'other' entry (see above)
4709 * if int passed, it add modifiers:
4710 * Possible values:
4711 * - CarbonInterface::DIFF_ABSOLUTE no modifiers
4712 * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
4713 * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
4714 * Default value: CarbonInterface::DIFF_ABSOLUTE
4715 * @param bool $short displays short format of time units
4716 * @param int $parts maximum number of parts to display (default value: 1: single unit)
4717 * @param int $options human diff options
4718 *
4719 * @return string
4720 */
4721 public function until($other = null, $syntax = null, $short = false, $parts = 1, $options = null);
4722
4723 /**
4724 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
4725 * You should rather use the ->settings() method.
4726 * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants
4727 * are available for quarters, years, decade, centuries, millennia (singular and plural forms).
4728 * @see settings
4729 *
4730 * Indicates if months should be calculated with overflow.
4731 *
4732 * @param bool $monthsOverflow
4733 *
4734 * @return void
4735 */
4736 public static function useMonthsOverflow(bool $monthsOverflow = true): void;
4737
4738 /**
4739 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
4740 * You should rather use the ->settings() method.
4741 * @see settings
4742 *
4743 * Enable the strict mode (or disable with passing false).
4744 *
4745 * @param bool $strictModeEnabled
4746 */
4747 public static function useStrictMode(bool $strictModeEnabled = true): void;
4748
4749 /**
4750 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
4751 * You should rather use the ->settings() method.
4752 * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants
4753 * are available for quarters, years, decade, centuries, millennia (singular and plural forms).
4754 * @see settings
4755 *
4756 * Indicates if years should be calculated with overflow.
4757 *
4758 * @param bool $yearsOverflow
4759 *
4760 * @return void
4761 */
4762 public static function useYearsOverflow(bool $yearsOverflow = true): void;
4763
4764 /**
4765 * Set the instance's timezone to UTC.
4766 */
4767 public function utc(): static;
4768
4769 /**
4770 * Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.
4771 */
4772 public function utcOffset(?int $minuteOffset = null): static|int;
4773
4774 /**
4775 * Returns the milliseconds timestamps used amongst other by Date javascript objects.
4776 *
4777 * @return float
4778 */
4779 public function valueOf(): float;
4780
4781 /**
4782 * Get/set the week number using given first day of week and first
4783 * day of year included in the first week. Or use US format if no settings
4784 * given (Sunday / Jan 6).
4785 *
4786 * @param int|null $week
4787 * @param int|null $dayOfWeek
4788 * @param int|null $dayOfYear
4789 *
4790 * @return int|static
4791 */
4792 public function week($week = null, $dayOfWeek = null, $dayOfYear = null);
4793
4794 /**
4795 * Set/get the week number of year using given first day of week and first
4796 * day of year included in the first week. Or use US format if no settings
4797 * given (Sunday / Jan 6).
4798 *
4799 * @param int|null $year if null, act as a getter, if not null, set the year and return current instance.
4800 * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
4801 * @param int|null $dayOfYear first day of year included in the week #1
4802 *
4803 * @return int|static
4804 */
4805 public function weekYear($year = null, $dayOfWeek = null, $dayOfYear = null);
4806
4807 /**
4808 * Get/set the weekday from 0 (Sunday) to 6 (Saturday).
4809 *
4810 * @param WeekDay|int|null $value new value for weekday if using as setter.
4811 */
4812 public function weekday(WeekDay|int|null $value = null): static|int;
4813
4814 /**
4815 * Get the number of weeks of the current week-year using given first day of week and first
4816 * day of year included in the first week. Or use US format if no settings
4817 * given (Sunday / Jan 6).
4818 *
4819 * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
4820 * @param int|null $dayOfYear first day of year included in the week #1
4821 *
4822 * @return int
4823 */
4824 public function weeksInYear($dayOfWeek = null, $dayOfYear = null);
4825
4826 /**
4827 * Temporarily sets a static date to be used within the callback.
4828 * Using setTestNow to set the date, executing the callback, then
4829 * clearing the test instance.
4830 *
4831 * /!\ Use this method for unit tests only.
4832 *
4833 * @template T
4834 *
4835 * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
4836 * @param Closure(): T $callback
4837 *
4838 * @return T
4839 */
4840 public static function withTestNow(mixed $testNow, callable $callback): mixed;
4841
4842 /**
4843 * Create a Carbon instance for yesterday.
4844 */
4845 public static function yesterday(DateTimeZone|string|int|null $timezone = null): static;
4846
4847 // </methods>
4848 }