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