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