1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,4643 +0,0 @@ |
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 |
-namespace Carbon; |
|
12 |
- |
|
13 |
-use Closure; |
|
14 |
-use DateInterval; |
|
15 |
-use DateTime; |
|
16 |
-use DateTimeInterface; |
|
17 |
-use InvalidArgumentException; |
|
18 |
-use JsonSerializable; |
|
19 |
-use ReflectionException; |
|
20 |
- |
|
21 |
-/** |
|
22 |
- * Common interface for Carbon and CarbonImmutable. |
|
23 |
- * |
|
24 |
- * <autodoc generated by `composer phpdoc`> |
|
25 |
- * |
|
26 |
- * @property int $year |
|
27 |
- * @property int $yearIso |
|
28 |
- * @property int $month |
|
29 |
- * @property int $day |
|
30 |
- * @property int $hour |
|
31 |
- * @property int $minute |
|
32 |
- * @property int $second |
|
33 |
- * @property int $micro |
|
34 |
- * @property int $microsecond |
|
35 |
- * @property int $timestamp seconds since the Unix Epoch |
|
36 |
- * @property string $englishDayOfWeek the day of week in English |
|
37 |
- * @property string $shortEnglishDayOfWeek the abbreviated day of week in English |
|
38 |
- * @property string $englishMonth the month in English |
|
39 |
- * @property string $shortEnglishMonth the abbreviated month in English |
|
40 |
- * @property string $localeDayOfWeek the day of week in current locale LC_TIME |
|
41 |
- * @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME |
|
42 |
- * @property string $localeMonth the month in current locale LC_TIME |
|
43 |
- * @property string $shortLocaleMonth the abbreviated month in current locale LC_TIME |
|
44 |
- * @property int $milliseconds |
|
45 |
- * @property int $millisecond |
|
46 |
- * @property int $milli |
|
47 |
- * @property int $week 1 through 53 |
|
48 |
- * @property int $isoWeek 1 through 53 |
|
49 |
- * @property int $weekYear year according to week format |
|
50 |
- * @property int $isoWeekYear year according to ISO week format |
|
51 |
- * @property int $dayOfYear 1 through 366 |
|
52 |
- * @property int $age does a diffInYears() with default parameters |
|
53 |
- * @property int $offset the timezone offset in seconds from UTC |
|
54 |
- * @property int $offsetMinutes the timezone offset in minutes from UTC |
|
55 |
- * @property int $offsetHours the timezone offset in hours from UTC |
|
56 |
- * @property CarbonTimeZone $timezone the current timezone |
|
57 |
- * @property CarbonTimeZone $tz alias of $timezone |
|
58 |
- * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) |
|
59 |
- * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) |
|
60 |
- * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday |
|
61 |
- * @property-read int $daysInMonth number of days in the given month |
|
62 |
- * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) |
|
63 |
- * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) |
|
64 |
- * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
65 |
- * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
66 |
- * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
67 |
- * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language |
|
68 |
- * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language |
|
69 |
- * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language |
|
70 |
- * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language |
|
71 |
- * @property-read int $noZeroHour current hour from 1 to 24 |
|
72 |
- * @property-read int $weeksInYear 51 through 53 |
|
73 |
- * @property-read int $isoWeeksInYear 51 through 53 |
|
74 |
- * @property-read int $weekOfMonth 1 through 5 |
|
75 |
- * @property-read int $weekNumberInMonth 1 through 5 |
|
76 |
- * @property-read int $firstWeekDay 0 through 6 |
|
77 |
- * @property-read int $lastWeekDay 0 through 6 |
|
78 |
- * @property-read int $daysInYear 365 or 366 |
|
79 |
- * @property-read int $quarter the quarter of this instance, 1 - 4 |
|
80 |
- * @property-read int $decade the decade of this instance |
|
81 |
- * @property-read int $century the century of this instance |
|
82 |
- * @property-read int $millennium the millennium of this instance |
|
83 |
- * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise |
|
84 |
- * @property-read bool $local checks if the timezone is local, true if local, false otherwise |
|
85 |
- * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise |
|
86 |
- * @property-read string $timezoneName the current timezone name |
|
87 |
- * @property-read string $tzName alias of $timezoneName |
|
88 |
- * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name |
|
89 |
- * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName |
|
90 |
- * @property-read string $locale locale of the current instance |
|
91 |
- * |
|
92 |
- * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) |
|
93 |
- * @method bool isLocal() Check if the current instance has non-UTC timezone. |
|
94 |
- * @method bool isValid() Check if the current instance is a valid date. |
|
95 |
- * @method bool isDST() Check if the current instance is in a daylight saving time. |
|
96 |
- * @method bool isSunday() Checks if the instance day is sunday. |
|
97 |
- * @method bool isMonday() Checks if the instance day is monday. |
|
98 |
- * @method bool isTuesday() Checks if the instance day is tuesday. |
|
99 |
- * @method bool isWednesday() Checks if the instance day is wednesday. |
|
100 |
- * @method bool isThursday() Checks if the instance day is thursday. |
|
101 |
- * @method bool isFriday() Checks if the instance day is friday. |
|
102 |
- * @method bool isSaturday() Checks if the instance day is saturday. |
|
103 |
- * @method bool isSameYear(\DateTimeInterface $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). |
|
104 |
- * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. |
|
105 |
- * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. |
|
106 |
- * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. |
|
107 |
- * @method bool isSameWeek(\DateTimeInterface $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). |
|
108 |
- * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. |
|
109 |
- * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. |
|
110 |
- * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. |
|
111 |
- * @method bool isSameDay(\DateTimeInterface $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). |
|
112 |
- * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. |
|
113 |
- * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. |
|
114 |
- * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. |
|
115 |
- * @method bool isSameHour(\DateTimeInterface $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). |
|
116 |
- * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. |
|
117 |
- * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. |
|
118 |
- * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. |
|
119 |
- * @method bool isSameMinute(\DateTimeInterface $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). |
|
120 |
- * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. |
|
121 |
- * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. |
|
122 |
- * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. |
|
123 |
- * @method bool isSameSecond(\DateTimeInterface $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). |
|
124 |
- * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. |
|
125 |
- * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. |
|
126 |
- * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. |
|
127 |
- * @method bool isSameMicro(\DateTimeInterface $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). |
|
128 |
- * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. |
|
129 |
- * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. |
|
130 |
- * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. |
|
131 |
- * @method bool isSameMicrosecond(\DateTimeInterface $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). |
|
132 |
- * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. |
|
133 |
- * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. |
|
134 |
- * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. |
|
135 |
- * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. |
|
136 |
- * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. |
|
137 |
- * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. |
|
138 |
- * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. |
|
139 |
- * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. |
|
140 |
- * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. |
|
141 |
- * @method bool isSameDecade(\DateTimeInterface $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). |
|
142 |
- * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. |
|
143 |
- * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. |
|
144 |
- * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. |
|
145 |
- * @method bool isSameCentury(\DateTimeInterface $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). |
|
146 |
- * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. |
|
147 |
- * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. |
|
148 |
- * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. |
|
149 |
- * @method bool isSameMillennium(\DateTimeInterface $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). |
|
150 |
- * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. |
|
151 |
- * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. |
|
152 |
- * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. |
|
153 |
- * @method $this years(int $value) Set current instance year to the given value. |
|
154 |
- * @method $this year(int $value) Set current instance year to the given value. |
|
155 |
- * @method $this setYears(int $value) Set current instance year to the given value. |
|
156 |
- * @method $this setYear(int $value) Set current instance year to the given value. |
|
157 |
- * @method $this months(int $value) Set current instance month to the given value. |
|
158 |
- * @method $this month(int $value) Set current instance month to the given value. |
|
159 |
- * @method $this setMonths(int $value) Set current instance month to the given value. |
|
160 |
- * @method $this setMonth(int $value) Set current instance month to the given value. |
|
161 |
- * @method $this days(int $value) Set current instance day to the given value. |
|
162 |
- * @method $this day(int $value) Set current instance day to the given value. |
|
163 |
- * @method $this setDays(int $value) Set current instance day to the given value. |
|
164 |
- * @method $this setDay(int $value) Set current instance day to the given value. |
|
165 |
- * @method $this hours(int $value) Set current instance hour to the given value. |
|
166 |
- * @method $this hour(int $value) Set current instance hour to the given value. |
|
167 |
- * @method $this setHours(int $value) Set current instance hour to the given value. |
|
168 |
- * @method $this setHour(int $value) Set current instance hour to the given value. |
|
169 |
- * @method $this minutes(int $value) Set current instance minute to the given value. |
|
170 |
- * @method $this minute(int $value) Set current instance minute to the given value. |
|
171 |
- * @method $this setMinutes(int $value) Set current instance minute to the given value. |
|
172 |
- * @method $this setMinute(int $value) Set current instance minute to the given value. |
|
173 |
- * @method $this seconds(int $value) Set current instance second to the given value. |
|
174 |
- * @method $this second(int $value) Set current instance second to the given value. |
|
175 |
- * @method $this setSeconds(int $value) Set current instance second to the given value. |
|
176 |
- * @method $this setSecond(int $value) Set current instance second to the given value. |
|
177 |
- * @method $this millis(int $value) Set current instance millisecond to the given value. |
|
178 |
- * @method $this milli(int $value) Set current instance millisecond to the given value. |
|
179 |
- * @method $this setMillis(int $value) Set current instance millisecond to the given value. |
|
180 |
- * @method $this setMilli(int $value) Set current instance millisecond to the given value. |
|
181 |
- * @method $this milliseconds(int $value) Set current instance millisecond to the given value. |
|
182 |
- * @method $this millisecond(int $value) Set current instance millisecond to the given value. |
|
183 |
- * @method $this setMilliseconds(int $value) Set current instance millisecond to the given value. |
|
184 |
- * @method $this setMillisecond(int $value) Set current instance millisecond to the given value. |
|
185 |
- * @method $this micros(int $value) Set current instance microsecond to the given value. |
|
186 |
- * @method $this micro(int $value) Set current instance microsecond to the given value. |
|
187 |
- * @method $this setMicros(int $value) Set current instance microsecond to the given value. |
|
188 |
- * @method $this setMicro(int $value) Set current instance microsecond to the given value. |
|
189 |
- * @method $this microseconds(int $value) Set current instance microsecond to the given value. |
|
190 |
- * @method $this microsecond(int $value) Set current instance microsecond to the given value. |
|
191 |
- * @method $this setMicroseconds(int $value) Set current instance microsecond to the given value. |
|
192 |
- * @method $this setMicrosecond(int $value) Set current instance microsecond to the given value. |
|
193 |
- * @method $this addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). |
|
194 |
- * @method $this addYear() Add one year to the instance (using date interval). |
|
195 |
- * @method $this subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). |
|
196 |
- * @method $this subYear() Sub one year to the instance (using date interval). |
|
197 |
- * @method $this addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
198 |
- * @method $this addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. |
|
199 |
- * @method $this subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
200 |
- * @method $this subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. |
|
201 |
- * @method $this addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
202 |
- * @method $this addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
203 |
- * @method $this subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
204 |
- * @method $this subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
205 |
- * @method $this addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
206 |
- * @method $this addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
207 |
- * @method $this subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
208 |
- * @method $this subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
209 |
- * @method $this addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
210 |
- * @method $this addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
211 |
- * @method $this subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
212 |
- * @method $this subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
213 |
- * @method $this addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). |
|
214 |
- * @method $this addMonth() Add one month to the instance (using date interval). |
|
215 |
- * @method $this subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). |
|
216 |
- * @method $this subMonth() Sub one month to the instance (using date interval). |
|
217 |
- * @method $this addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
218 |
- * @method $this addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. |
|
219 |
- * @method $this subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
220 |
- * @method $this subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. |
|
221 |
- * @method $this addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
222 |
- * @method $this addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
223 |
- * @method $this subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
224 |
- * @method $this subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
225 |
- * @method $this addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
226 |
- * @method $this addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
227 |
- * @method $this subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
228 |
- * @method $this subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
229 |
- * @method $this addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
230 |
- * @method $this addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
231 |
- * @method $this subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
232 |
- * @method $this subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
233 |
- * @method $this addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). |
|
234 |
- * @method $this addDay() Add one day to the instance (using date interval). |
|
235 |
- * @method $this subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). |
|
236 |
- * @method $this subDay() Sub one day to the instance (using date interval). |
|
237 |
- * @method $this addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). |
|
238 |
- * @method $this addHour() Add one hour to the instance (using date interval). |
|
239 |
- * @method $this subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). |
|
240 |
- * @method $this subHour() Sub one hour to the instance (using date interval). |
|
241 |
- * @method $this addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). |
|
242 |
- * @method $this addMinute() Add one minute to the instance (using date interval). |
|
243 |
- * @method $this subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). |
|
244 |
- * @method $this subMinute() Sub one minute to the instance (using date interval). |
|
245 |
- * @method $this addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). |
|
246 |
- * @method $this addSecond() Add one second to the instance (using date interval). |
|
247 |
- * @method $this subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). |
|
248 |
- * @method $this subSecond() Sub one second to the instance (using date interval). |
|
249 |
- * @method $this addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). |
|
250 |
- * @method $this addMilli() Add one millisecond to the instance (using date interval). |
|
251 |
- * @method $this subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). |
|
252 |
- * @method $this subMilli() Sub one millisecond to the instance (using date interval). |
|
253 |
- * @method $this addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). |
|
254 |
- * @method $this addMillisecond() Add one millisecond to the instance (using date interval). |
|
255 |
- * @method $this subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). |
|
256 |
- * @method $this subMillisecond() Sub one millisecond to the instance (using date interval). |
|
257 |
- * @method $this addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). |
|
258 |
- * @method $this addMicro() Add one microsecond to the instance (using date interval). |
|
259 |
- * @method $this subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). |
|
260 |
- * @method $this subMicro() Sub one microsecond to the instance (using date interval). |
|
261 |
- * @method $this addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). |
|
262 |
- * @method $this addMicrosecond() Add one microsecond to the instance (using date interval). |
|
263 |
- * @method $this subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). |
|
264 |
- * @method $this subMicrosecond() Sub one microsecond to the instance (using date interval). |
|
265 |
- * @method $this addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). |
|
266 |
- * @method $this addMillennium() Add one millennium to the instance (using date interval). |
|
267 |
- * @method $this subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). |
|
268 |
- * @method $this subMillennium() Sub one millennium to the instance (using date interval). |
|
269 |
- * @method $this addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
270 |
- * @method $this addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. |
|
271 |
- * @method $this subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
272 |
- * @method $this subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. |
|
273 |
- * @method $this addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
274 |
- * @method $this addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
275 |
- * @method $this subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
276 |
- * @method $this subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
277 |
- * @method $this addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
278 |
- * @method $this addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
279 |
- * @method $this subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
280 |
- * @method $this subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
281 |
- * @method $this addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
282 |
- * @method $this addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
283 |
- * @method $this subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
284 |
- * @method $this subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
285 |
- * @method $this addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). |
|
286 |
- * @method $this addCentury() Add one century to the instance (using date interval). |
|
287 |
- * @method $this subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). |
|
288 |
- * @method $this subCentury() Sub one century to the instance (using date interval). |
|
289 |
- * @method $this addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
290 |
- * @method $this addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. |
|
291 |
- * @method $this subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
292 |
- * @method $this subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. |
|
293 |
- * @method $this addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
294 |
- * @method $this addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
295 |
- * @method $this subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
296 |
- * @method $this subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
297 |
- * @method $this addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
298 |
- * @method $this addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
299 |
- * @method $this subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
300 |
- * @method $this subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
301 |
- * @method $this addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
302 |
- * @method $this addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
303 |
- * @method $this subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
304 |
- * @method $this subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
305 |
- * @method $this addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). |
|
306 |
- * @method $this addDecade() Add one decade to the instance (using date interval). |
|
307 |
- * @method $this subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). |
|
308 |
- * @method $this subDecade() Sub one decade to the instance (using date interval). |
|
309 |
- * @method $this addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
310 |
- * @method $this addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. |
|
311 |
- * @method $this subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
312 |
- * @method $this subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. |
|
313 |
- * @method $this addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
314 |
- * @method $this addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
315 |
- * @method $this subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
316 |
- * @method $this subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
317 |
- * @method $this addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
318 |
- * @method $this addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
319 |
- * @method $this subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
320 |
- * @method $this subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
321 |
- * @method $this addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
322 |
- * @method $this addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
323 |
- * @method $this subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
324 |
- * @method $this subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
325 |
- * @method $this addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). |
|
326 |
- * @method $this addQuarter() Add one quarter to the instance (using date interval). |
|
327 |
- * @method $this subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). |
|
328 |
- * @method $this subQuarter() Sub one quarter to the instance (using date interval). |
|
329 |
- * @method $this addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
330 |
- * @method $this addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. |
|
331 |
- * @method $this subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
332 |
- * @method $this subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. |
|
333 |
- * @method $this addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
334 |
- * @method $this addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
335 |
- * @method $this subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
336 |
- * @method $this subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
337 |
- * @method $this addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
338 |
- * @method $this addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
339 |
- * @method $this subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
340 |
- * @method $this subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
341 |
- * @method $this addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
342 |
- * @method $this addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
343 |
- * @method $this subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
344 |
- * @method $this subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
345 |
- * @method $this addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). |
|
346 |
- * @method $this addWeek() Add one week to the instance (using date interval). |
|
347 |
- * @method $this subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). |
|
348 |
- * @method $this subWeek() Sub one week to the instance (using date interval). |
|
349 |
- * @method $this addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). |
|
350 |
- * @method $this addWeekday() Add one weekday to the instance (using date interval). |
|
351 |
- * @method $this subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). |
|
352 |
- * @method $this subWeekday() Sub one weekday to the instance (using date interval). |
|
353 |
- * @method $this addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). |
|
354 |
- * @method $this addRealMicro() Add one microsecond to the instance (using timestamp). |
|
355 |
- * @method $this subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). |
|
356 |
- * @method $this subRealMicro() Sub one microsecond to the instance (using timestamp). |
|
357 |
- * @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. |
|
358 |
- * @method $this addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). |
|
359 |
- * @method $this addRealMicrosecond() Add one microsecond to the instance (using timestamp). |
|
360 |
- * @method $this subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). |
|
361 |
- * @method $this subRealMicrosecond() Sub one microsecond to the instance (using timestamp). |
|
362 |
- * @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. |
|
363 |
- * @method $this addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). |
|
364 |
- * @method $this addRealMilli() Add one millisecond to the instance (using timestamp). |
|
365 |
- * @method $this subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). |
|
366 |
- * @method $this subRealMilli() Sub one millisecond to the instance (using timestamp). |
|
367 |
- * @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. |
|
368 |
- * @method $this addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). |
|
369 |
- * @method $this addRealMillisecond() Add one millisecond to the instance (using timestamp). |
|
370 |
- * @method $this subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). |
|
371 |
- * @method $this subRealMillisecond() Sub one millisecond to the instance (using timestamp). |
|
372 |
- * @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. |
|
373 |
- * @method $this addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). |
|
374 |
- * @method $this addRealSecond() Add one second to the instance (using timestamp). |
|
375 |
- * @method $this subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). |
|
376 |
- * @method $this subRealSecond() Sub one second to the instance (using timestamp). |
|
377 |
- * @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. |
|
378 |
- * @method $this addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). |
|
379 |
- * @method $this addRealMinute() Add one minute to the instance (using timestamp). |
|
380 |
- * @method $this subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). |
|
381 |
- * @method $this subRealMinute() Sub one minute to the instance (using timestamp). |
|
382 |
- * @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. |
|
383 |
- * @method $this addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). |
|
384 |
- * @method $this addRealHour() Add one hour to the instance (using timestamp). |
|
385 |
- * @method $this subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). |
|
386 |
- * @method $this subRealHour() Sub one hour to the instance (using timestamp). |
|
387 |
- * @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. |
|
388 |
- * @method $this addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). |
|
389 |
- * @method $this addRealDay() Add one day to the instance (using timestamp). |
|
390 |
- * @method $this subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). |
|
391 |
- * @method $this subRealDay() Sub one day to the instance (using timestamp). |
|
392 |
- * @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. |
|
393 |
- * @method $this addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). |
|
394 |
- * @method $this addRealWeek() Add one week to the instance (using timestamp). |
|
395 |
- * @method $this subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). |
|
396 |
- * @method $this subRealWeek() Sub one week to the instance (using timestamp). |
|
397 |
- * @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. |
|
398 |
- * @method $this addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). |
|
399 |
- * @method $this addRealMonth() Add one month to the instance (using timestamp). |
|
400 |
- * @method $this subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). |
|
401 |
- * @method $this subRealMonth() Sub one month to the instance (using timestamp). |
|
402 |
- * @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. |
|
403 |
- * @method $this addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). |
|
404 |
- * @method $this addRealQuarter() Add one quarter to the instance (using timestamp). |
|
405 |
- * @method $this subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). |
|
406 |
- * @method $this subRealQuarter() Sub one quarter to the instance (using timestamp). |
|
407 |
- * @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. |
|
408 |
- * @method $this addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). |
|
409 |
- * @method $this addRealYear() Add one year to the instance (using timestamp). |
|
410 |
- * @method $this subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). |
|
411 |
- * @method $this subRealYear() Sub one year to the instance (using timestamp). |
|
412 |
- * @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. |
|
413 |
- * @method $this addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). |
|
414 |
- * @method $this addRealDecade() Add one decade to the instance (using timestamp). |
|
415 |
- * @method $this subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). |
|
416 |
- * @method $this subRealDecade() Sub one decade to the instance (using timestamp). |
|
417 |
- * @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. |
|
418 |
- * @method $this addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). |
|
419 |
- * @method $this addRealCentury() Add one century to the instance (using timestamp). |
|
420 |
- * @method $this subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). |
|
421 |
- * @method $this subRealCentury() Sub one century to the instance (using timestamp). |
|
422 |
- * @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. |
|
423 |
- * @method $this addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). |
|
424 |
- * @method $this addRealMillennium() Add one millennium to the instance (using timestamp). |
|
425 |
- * @method $this subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). |
|
426 |
- * @method $this subRealMillennium() Sub one millennium to the instance (using timestamp). |
|
427 |
- * @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. |
|
428 |
- * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. |
|
429 |
- * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. |
|
430 |
- * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. |
|
431 |
- * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. |
|
432 |
- * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. |
|
433 |
- * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. |
|
434 |
- * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. |
|
435 |
- * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. |
|
436 |
- * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. |
|
437 |
- * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. |
|
438 |
- * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. |
|
439 |
- * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. |
|
440 |
- * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. |
|
441 |
- * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. |
|
442 |
- * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. |
|
443 |
- * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. |
|
444 |
- * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. |
|
445 |
- * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. |
|
446 |
- * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. |
|
447 |
- * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. |
|
448 |
- * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. |
|
449 |
- * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. |
|
450 |
- * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. |
|
451 |
- * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. |
|
452 |
- * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. |
|
453 |
- * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. |
|
454 |
- * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. |
|
455 |
- * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. |
|
456 |
- * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. |
|
457 |
- * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. |
|
458 |
- * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. |
|
459 |
- * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. |
|
460 |
- * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. |
|
461 |
- * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. |
|
462 |
- * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. |
|
463 |
- * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. |
|
464 |
- * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. |
|
465 |
- * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. |
|
466 |
- * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. |
|
467 |
- * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. |
|
468 |
- * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. |
|
469 |
- * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. |
|
470 |
- * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. |
|
471 |
- * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. |
|
472 |
- * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. |
|
473 |
- * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. |
|
474 |
- * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. |
|
475 |
- * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. |
|
476 |
- * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. |
|
477 |
- * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. |
|
478 |
- * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. |
|
479 |
- * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. |
|
480 |
- * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. |
|
481 |
- * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. |
|
482 |
- * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. |
|
483 |
- * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. |
|
484 |
- * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. |
|
485 |
- * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. |
|
486 |
- * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. |
|
487 |
- * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. |
|
488 |
- * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. |
|
489 |
- * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. |
|
490 |
- * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. |
|
491 |
- * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. |
|
492 |
- * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. |
|
493 |
- * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. |
|
494 |
- * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. |
|
495 |
- * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. |
|
496 |
- * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. |
|
497 |
- * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. |
|
498 |
- * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. |
|
499 |
- * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. |
|
500 |
- * @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.) |
|
501 |
- * @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.) |
|
502 |
- * @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.) |
|
503 |
- * @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.) |
|
504 |
- * @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.) |
|
505 |
- * @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.) |
|
506 |
- * @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.) |
|
507 |
- * @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.) |
|
508 |
- * |
|
509 |
- * </autodoc> |
|
510 |
- */ |
|
511 |
-interface CarbonInterface extends DateTimeInterface, JsonSerializable |
|
512 |
-{ |
|
513 |
- /** |
|
514 |
- * Diff wording options(expressed in octal). |
|
515 |
- */ |
|
516 |
- public const NO_ZERO_DIFF = 01; |
|
517 |
- public const JUST_NOW = 02; |
|
518 |
- public const ONE_DAY_WORDS = 04; |
|
519 |
- public const TWO_DAY_WORDS = 010; |
|
520 |
- public const SEQUENTIAL_PARTS_ONLY = 020; |
|
521 |
- |
|
522 |
- /** |
|
523 |
- * Diff syntax options. |
|
524 |
- */ |
|
525 |
- public const DIFF_ABSOLUTE = 1; // backward compatibility with true |
|
526 |
- public const DIFF_RELATIVE_AUTO = 0; // backward compatibility with false |
|
527 |
- public const DIFF_RELATIVE_TO_NOW = 2; |
|
528 |
- public const DIFF_RELATIVE_TO_OTHER = 3; |
|
529 |
- |
|
530 |
- /** |
|
531 |
- * Translate string options. |
|
532 |
- */ |
|
533 |
- public const TRANSLATE_MONTHS = 1; |
|
534 |
- public const TRANSLATE_DAYS = 2; |
|
535 |
- public const TRANSLATE_UNITS = 4; |
|
536 |
- public const TRANSLATE_MERIDIEM = 8; |
|
537 |
- public const TRANSLATE_ALL = self::TRANSLATE_MONTHS | self::TRANSLATE_DAYS | self::TRANSLATE_UNITS | self::TRANSLATE_MERIDIEM; |
|
538 |
- |
|
539 |
- /** |
|
540 |
- * The day constants. |
|
541 |
- */ |
|
542 |
- public const SUNDAY = 0; |
|
543 |
- public const MONDAY = 1; |
|
544 |
- public const TUESDAY = 2; |
|
545 |
- public const WEDNESDAY = 3; |
|
546 |
- public const THURSDAY = 4; |
|
547 |
- public const FRIDAY = 5; |
|
548 |
- public const SATURDAY = 6; |
|
549 |
- |
|
550 |
- /** |
|
551 |
- * Number of X in Y. |
|
552 |
- */ |
|
553 |
- public const YEARS_PER_MILLENNIUM = 1000; |
|
554 |
- public const YEARS_PER_CENTURY = 100; |
|
555 |
- public const YEARS_PER_DECADE = 10; |
|
556 |
- public const MONTHS_PER_YEAR = 12; |
|
557 |
- public const MONTHS_PER_QUARTER = 3; |
|
558 |
- public const WEEKS_PER_YEAR = 52; |
|
559 |
- public const WEEKS_PER_MONTH = 4; |
|
560 |
- public const DAYS_PER_WEEK = 7; |
|
561 |
- public const HOURS_PER_DAY = 24; |
|
562 |
- public const MINUTES_PER_HOUR = 60; |
|
563 |
- public const SECONDS_PER_MINUTE = 60; |
|
564 |
- public const MILLISECONDS_PER_SECOND = 1000; |
|
565 |
- public const MICROSECONDS_PER_MILLISECOND = 1000; |
|
566 |
- public const MICROSECONDS_PER_SECOND = 1000000; |
|
567 |
- |
|
568 |
- /** |
|
569 |
- * RFC7231 DateTime format. |
|
570 |
- * |
|
571 |
- * @var string |
|
572 |
- */ |
|
573 |
- public const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T'; |
|
574 |
- |
|
575 |
- /** |
|
576 |
- * Default format to use for __toString method when type juggling occurs. |
|
577 |
- * |
|
578 |
- * @var string |
|
579 |
- */ |
|
580 |
- public const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s'; |
|
581 |
- |
|
582 |
- /** |
|
583 |
- * Format for converting mocked time, includes microseconds. |
|
584 |
- * |
|
585 |
- * @var string |
|
586 |
- */ |
|
587 |
- public const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u'; |
|
588 |
- |
|
589 |
- /** |
|
590 |
- * Pattern detection for ->isoFormat and ::createFromIsoFormat. |
|
591 |
- * |
|
592 |
- * @var string |
|
593 |
- */ |
|
594 |
- 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?)'; |
|
595 |
- |
|
596 |
- // <methods> |
|
597 |
- |
|
598 |
- /** |
|
599 |
- * Dynamically handle calls to the class. |
|
600 |
- * |
|
601 |
- * @param string $method magic method name called |
|
602 |
- * @param array $parameters parameters list |
|
603 |
- * |
|
604 |
- * @throws \BadMethodCallException|\ReflectionException |
|
605 |
- * |
|
606 |
- * @return mixed |
|
607 |
- */ |
|
608 |
- public function __call($method, $parameters); |
|
609 |
- |
|
610 |
- /** |
|
611 |
- * Dynamically handle calls to the class. |
|
612 |
- * |
|
613 |
- * @param string $method magic method name called |
|
614 |
- * @param array $parameters parameters list |
|
615 |
- * |
|
616 |
- * @throws \BadMethodCallException |
|
617 |
- * |
|
618 |
- * @return mixed |
|
619 |
- */ |
|
620 |
- public static function __callStatic($method, $parameters); |
|
621 |
- |
|
622 |
- /** |
|
623 |
- * Create a new Carbon instance. |
|
624 |
- * |
|
625 |
- * Please see the testing aids section (specifically static::setTestNow()) |
|
626 |
- * for more on the possibility of this constructor returning a test instance. |
|
627 |
- * |
|
628 |
- * @param string|null $time |
|
629 |
- * @param \DateTimeZone|string|null $tz |
|
630 |
- */ |
|
631 |
- public function __construct($time = null, $tz = null); |
|
632 |
- |
|
633 |
- /** |
|
634 |
- * Show truthy properties on var_dump(). |
|
635 |
- * |
|
636 |
- * @return array |
|
637 |
- */ |
|
638 |
- public function __debugInfo(); |
|
639 |
- |
|
640 |
- /** |
|
641 |
- * Get a part of the Carbon object |
|
642 |
- * |
|
643 |
- * @param string $name |
|
644 |
- * |
|
645 |
- * @throws InvalidArgumentException|ReflectionException |
|
646 |
- * |
|
647 |
- * @return string|int|bool|\DateTimeZone|null |
|
648 |
- */ |
|
649 |
- public function __get($name); |
|
650 |
- |
|
651 |
- /** |
|
652 |
- * Check if an attribute exists on the object |
|
653 |
- * |
|
654 |
- * @param string $name |
|
655 |
- * |
|
656 |
- * @return bool |
|
657 |
- */ |
|
658 |
- public function __isset($name); |
|
659 |
- |
|
660 |
- /** |
|
661 |
- * Set a part of the Carbon object |
|
662 |
- * |
|
663 |
- * @param string $name |
|
664 |
- * @param string|int|\DateTimeZone $value |
|
665 |
- * |
|
666 |
- * @throws InvalidArgumentException|ReflectionException |
|
667 |
- * |
|
668 |
- * @return void |
|
669 |
- */ |
|
670 |
- public function __set($name, $value); |
|
671 |
- |
|
672 |
- /** |
|
673 |
- * The __set_state handler. |
|
674 |
- * |
|
675 |
- * @param string|array $dump |
|
676 |
- * |
|
677 |
- * @return static |
|
678 |
- */ |
|
679 |
- public static function __set_state($dump); |
|
680 |
- |
|
681 |
- /** |
|
682 |
- * Returns the list of properties to dump on serialize() called on. |
|
683 |
- * |
|
684 |
- * @return array |
|
685 |
- */ |
|
686 |
- public function __sleep(); |
|
687 |
- |
|
688 |
- /** |
|
689 |
- * Format the instance as a string using the set format |
|
690 |
- * |
|
691 |
- * @example |
|
692 |
- * ``` |
|
693 |
- * echo Carbon::now(); // Carbon instances can be casted to string |
|
694 |
- * ``` |
|
695 |
- * |
|
696 |
- * @return string |
|
697 |
- */ |
|
698 |
- public function __toString(); |
|
699 |
- |
|
700 |
- /** |
|
701 |
- * Add given units or interval to the current instance. |
|
702 |
- * |
|
703 |
- * @example $date->add('hour', 3) |
|
704 |
- * @example $date->add(15, 'days') |
|
705 |
- * @example $date->add(CarbonInterval::days(4)) |
|
706 |
- * |
|
707 |
- * @param string|DateInterval $unit |
|
708 |
- * @param int $value |
|
709 |
- * @param bool|null $overflow |
|
710 |
- * |
|
711 |
- * @return CarbonInterface |
|
712 |
- */ |
|
713 |
- public function add($unit, $value = 1, $overflow = null); |
|
714 |
- |
|
715 |
- /** |
|
716 |
- * Add seconds to the instance using timestamp. Positive $value travels |
|
717 |
- * forward while negative $value travels into the past. |
|
718 |
- * |
|
719 |
- * @param string $unit |
|
720 |
- * @param int $value |
|
721 |
- * |
|
722 |
- * @return static |
|
723 |
- */ |
|
724 |
- public function addRealUnit($unit, $value = 1); |
|
725 |
- |
|
726 |
- /** |
|
727 |
- * Add given units to the current instance. |
|
728 |
- * |
|
729 |
- * @param string $unit |
|
730 |
- * @param int $value |
|
731 |
- * @param bool|null $overflow |
|
732 |
- * |
|
733 |
- * @return CarbonInterface |
|
734 |
- */ |
|
735 |
- public function addUnit($unit, $value = 1, $overflow = null); |
|
736 |
- |
|
737 |
- /** |
|
738 |
- * Add any unit to a new value without overflowing current other unit given. |
|
739 |
- * |
|
740 |
- * @param string $valueUnit unit name to modify |
|
741 |
- * @param int $value amount to add to the input unit |
|
742 |
- * @param string $overflowUnit unit name to not overflow |
|
743 |
- * |
|
744 |
- * @return static |
|
745 |
- */ |
|
746 |
- public function addUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
747 |
- |
|
748 |
- /** |
|
749 |
- * Get the difference in a human readable format in the current locale from an other |
|
750 |
- * instance given to now |
|
751 |
- * |
|
752 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
753 |
- * - 'syntax' entry (see below) |
|
754 |
- * - 'short' entry (see below) |
|
755 |
- * - 'parts' entry (see below) |
|
756 |
- * - 'options' entry (see below) |
|
757 |
- * - 'join' entry determines how to join multiple parts of the string |
|
758 |
- * ` - if $join is a string, it's used as a joiner glue |
|
759 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
760 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
761 |
- * ` will be used instead of the glue for the last item |
|
762 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
763 |
- * ` - if $join is missing, a space will be used as glue |
|
764 |
- * if int passed, it add modifiers: |
|
765 |
- * Possible values: |
|
766 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
767 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
768 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
769 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
770 |
- * @param bool $short displays short format of time units |
|
771 |
- * @param int $parts maximum number of parts to display (default value: 1: single part) |
|
772 |
- * @param int $options human diff options |
|
773 |
- * |
|
774 |
- * @return string |
|
775 |
- */ |
|
776 |
- public function ago($syntax = null, $short = false, $parts = 1, $options = null); |
|
777 |
- |
|
778 |
- /** |
|
779 |
- * Modify the current instance to the average of a given instance (default now) and the current instance |
|
780 |
- * (second-precision). |
|
781 |
- * |
|
782 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date |
|
783 |
- * |
|
784 |
- * @return static |
|
785 |
- */ |
|
786 |
- public function average($date = null); |
|
787 |
- |
|
788 |
- /** |
|
789 |
- * Determines if the instance is between two others |
|
790 |
- * |
|
791 |
- * @example |
|
792 |
- * ``` |
|
793 |
- * Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true |
|
794 |
- * Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false |
|
795 |
- * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // false |
|
796 |
- * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', true); // true |
|
797 |
- * ``` |
|
798 |
- * |
|
799 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
800 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
801 |
- * @param bool $equal Indicates if an equal to comparison should be done |
|
802 |
- * |
|
803 |
- * @return bool |
|
804 |
- */ |
|
805 |
- public function between($date1, $date2, $equal = true): bool; |
|
806 |
- |
|
807 |
- /** |
|
808 |
- * Returns either the close date "Friday 15h30", or a calendar date "10/09/2017" is farthest than 7 days from now. |
|
809 |
- * |
|
810 |
- * @param Carbon|\DateTimeInterface|string|null $referenceTime |
|
811 |
- * @param array $formats |
|
812 |
- * |
|
813 |
- * @return string |
|
814 |
- */ |
|
815 |
- public function calendar($referenceTime = null, array $formats = []); |
|
816 |
- |
|
817 |
- /** |
|
818 |
- * Cast the current instance into the given class. |
|
819 |
- * |
|
820 |
- * @param string $className The $className::instance() method will be called to cast the current object. |
|
821 |
- * |
|
822 |
- * @return object |
|
823 |
- */ |
|
824 |
- public function cast(string $className); |
|
825 |
- |
|
826 |
- /** |
|
827 |
- * Ceil the current instance second with given precision if specified. |
|
828 |
- * |
|
829 |
- * @param float|int $precision |
|
830 |
- * |
|
831 |
- * @return CarbonInterface |
|
832 |
- */ |
|
833 |
- public function ceil($precision = 1); |
|
834 |
- |
|
835 |
- /** |
|
836 |
- * Ceil the current instance at the given unit with given precision if specified. |
|
837 |
- * |
|
838 |
- * @param string $unit |
|
839 |
- * @param float|int $precision |
|
840 |
- * |
|
841 |
- * @return CarbonInterface |
|
842 |
- */ |
|
843 |
- public function ceilUnit($unit, $precision = 1); |
|
844 |
- |
|
845 |
- /** |
|
846 |
- * Ceil the current instance week. |
|
847 |
- * |
|
848 |
- * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
849 |
- * |
|
850 |
- * @return CarbonInterface |
|
851 |
- */ |
|
852 |
- public function ceilWeek($weekStartsAt = null); |
|
853 |
- |
|
854 |
- /** |
|
855 |
- * Similar to native modify() method of DateTime but can handle more grammars. |
|
856 |
- * |
|
857 |
- * @example |
|
858 |
- * ``` |
|
859 |
- * echo Carbon::now()->change('next 2pm'); |
|
860 |
- * ``` |
|
861 |
- * |
|
862 |
- * @link https://php.net/manual/en/datetime.modify.php |
|
863 |
- * |
|
864 |
- * @param string $modifier |
|
865 |
- * |
|
866 |
- * @return static |
|
867 |
- */ |
|
868 |
- public function change($modifier); |
|
869 |
- |
|
870 |
- /** |
|
871 |
- * @alias copy |
|
872 |
- * |
|
873 |
- * Get a copy of the instance. |
|
874 |
- * |
|
875 |
- * @return static |
|
876 |
- */ |
|
877 |
- public function clone(); |
|
878 |
- |
|
879 |
- /** |
|
880 |
- * Get the closest date from the instance (second-precision). |
|
881 |
- * |
|
882 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
883 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
884 |
- * |
|
885 |
- * @return static |
|
886 |
- */ |
|
887 |
- public function closest($date1, $date2); |
|
888 |
- |
|
889 |
- /** |
|
890 |
- * Get a copy of the instance. |
|
891 |
- * |
|
892 |
- * @return static |
|
893 |
- */ |
|
894 |
- public function copy(); |
|
895 |
- |
|
896 |
- /** |
|
897 |
- * Create a new Carbon instance from a specific date and time. |
|
898 |
- * |
|
899 |
- * If any of $year, $month or $day are set to null their now() values will |
|
900 |
- * be used. |
|
901 |
- * |
|
902 |
- * If $hour is null it will be set to its now() value and the default |
|
903 |
- * values for $minute and $second will be their now() values. |
|
904 |
- * |
|
905 |
- * If $hour is not null then the default values for $minute and $second |
|
906 |
- * will be 0. |
|
907 |
- * |
|
908 |
- * @param int|null $year |
|
909 |
- * @param int|null $month |
|
910 |
- * @param int|null $day |
|
911 |
- * @param int|null $hour |
|
912 |
- * @param int|null $minute |
|
913 |
- * @param int|null $second |
|
914 |
- * @param \DateTimeZone|string|null $tz |
|
915 |
- * |
|
916 |
- * @throws \InvalidArgumentException |
|
917 |
- * |
|
918 |
- * @return static |
|
919 |
- */ |
|
920 |
- public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null); |
|
921 |
- |
|
922 |
- /** |
|
923 |
- * Create a Carbon instance from just a date. The time portion is set to now. |
|
924 |
- * |
|
925 |
- * @param int|null $year |
|
926 |
- * @param int|null $month |
|
927 |
- * @param int|null $day |
|
928 |
- * @param \DateTimeZone|string|null $tz |
|
929 |
- * |
|
930 |
- * @throws \InvalidArgumentException |
|
931 |
- * |
|
932 |
- * @return static |
|
933 |
- */ |
|
934 |
- public static function createFromDate($year = null, $month = null, $day = null, $tz = null); |
|
935 |
- |
|
936 |
- /** |
|
937 |
- * Create a Carbon instance from a specific format. |
|
938 |
- * |
|
939 |
- * @param string $format Datetime format |
|
940 |
- * @param string $time |
|
941 |
- * @param \DateTimeZone|string|false|null $tz |
|
942 |
- * |
|
943 |
- * @throws InvalidArgumentException |
|
944 |
- * |
|
945 |
- * @return static|false |
|
946 |
- */ |
|
947 |
- public static function createFromFormat($format, $time, $tz = null); |
|
948 |
- |
|
949 |
- /** |
|
950 |
- * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). |
|
951 |
- * |
|
952 |
- * @param string $format Datetime format |
|
953 |
- * @param string $time |
|
954 |
- * @param \DateTimeZone|string|false|null $tz optional timezone |
|
955 |
- * @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) |
|
956 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator optional custom translator to use for macro-formats |
|
957 |
- * |
|
958 |
- * @throws InvalidArgumentException |
|
959 |
- * |
|
960 |
- * @return static|false |
|
961 |
- */ |
|
962 |
- public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null); |
|
963 |
- |
|
964 |
- /** |
|
965 |
- * Create a Carbon instance from a specific format and a string in a given language. |
|
966 |
- * |
|
967 |
- * @param string $format Datetime format |
|
968 |
- * @param string $locale |
|
969 |
- * @param string $time |
|
970 |
- * @param \DateTimeZone|string|false|null $tz |
|
971 |
- * |
|
972 |
- * @throws InvalidArgumentException |
|
973 |
- * |
|
974 |
- * @return static|false |
|
975 |
- */ |
|
976 |
- public static function createFromLocaleFormat($format, $locale, $time, $tz = null); |
|
977 |
- |
|
978 |
- /** |
|
979 |
- * Create a Carbon instance from a specific ISO format and a string in a given language. |
|
980 |
- * |
|
981 |
- * @param string $format Datetime ISO format |
|
982 |
- * @param string $locale |
|
983 |
- * @param string $time |
|
984 |
- * @param \DateTimeZone|string|false|null $tz |
|
985 |
- * |
|
986 |
- * @throws InvalidArgumentException |
|
987 |
- * |
|
988 |
- * @return static|false |
|
989 |
- */ |
|
990 |
- public static function createFromLocaleIsoFormat($format, $locale, $time, $tz = null); |
|
991 |
- |
|
992 |
- /** |
|
993 |
- * Create a Carbon instance from just a time. The date portion is set to today. |
|
994 |
- * |
|
995 |
- * @param int|null $hour |
|
996 |
- * @param int|null $minute |
|
997 |
- * @param int|null $second |
|
998 |
- * @param \DateTimeZone|string|null $tz |
|
999 |
- * |
|
1000 |
- * @throws \InvalidArgumentException |
|
1001 |
- * |
|
1002 |
- * @return static |
|
1003 |
- */ |
|
1004 |
- public static function createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null); |
|
1005 |
- |
|
1006 |
- /** |
|
1007 |
- * Create a Carbon instance from a time string. The date portion is set to today. |
|
1008 |
- * |
|
1009 |
- * @param string $time |
|
1010 |
- * @param \DateTimeZone|string|null $tz |
|
1011 |
- * |
|
1012 |
- * @throws \InvalidArgumentException |
|
1013 |
- * |
|
1014 |
- * @return static |
|
1015 |
- */ |
|
1016 |
- public static function createFromTimeString($time, $tz = null); |
|
1017 |
- |
|
1018 |
- /** |
|
1019 |
- * Create a Carbon instance from a timestamp. |
|
1020 |
- * |
|
1021 |
- * @param int $timestamp |
|
1022 |
- * @param \DateTimeZone|string|null $tz |
|
1023 |
- * |
|
1024 |
- * @return static |
|
1025 |
- */ |
|
1026 |
- public static function createFromTimestamp($timestamp, $tz = null); |
|
1027 |
- |
|
1028 |
- /** |
|
1029 |
- * Create a Carbon instance from a timestamp in milliseconds. |
|
1030 |
- * |
|
1031 |
- * @param int $timestamp |
|
1032 |
- * @param \DateTimeZone|string|null $tz |
|
1033 |
- * |
|
1034 |
- * @return static |
|
1035 |
- */ |
|
1036 |
- public static function createFromTimestampMs($timestamp, $tz = null); |
|
1037 |
- |
|
1038 |
- /** |
|
1039 |
- * Create a Carbon instance from an UTC timestamp. |
|
1040 |
- * |
|
1041 |
- * @param int $timestamp |
|
1042 |
- * |
|
1043 |
- * @return static |
|
1044 |
- */ |
|
1045 |
- public static function createFromTimestampUTC($timestamp); |
|
1046 |
- |
|
1047 |
- /** |
|
1048 |
- * Create a Carbon instance from just a date. The time portion is set to midnight. |
|
1049 |
- * |
|
1050 |
- * @param int|null $year |
|
1051 |
- * @param int|null $month |
|
1052 |
- * @param int|null $day |
|
1053 |
- * @param \DateTimeZone|string|null $tz |
|
1054 |
- * |
|
1055 |
- * @return static |
|
1056 |
- */ |
|
1057 |
- public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null); |
|
1058 |
- |
|
1059 |
- /** |
|
1060 |
- * Create a new safe Carbon instance from a specific date and time. |
|
1061 |
- * |
|
1062 |
- * If any of $year, $month or $day are set to null their now() values will |
|
1063 |
- * be used. |
|
1064 |
- * |
|
1065 |
- * If $hour is null it will be set to its now() value and the default |
|
1066 |
- * values for $minute and $second will be their now() values. |
|
1067 |
- * |
|
1068 |
- * If $hour is not null then the default values for $minute and $second |
|
1069 |
- * will be 0. |
|
1070 |
- * |
|
1071 |
- * If one of the set values is not valid, an \InvalidArgumentException |
|
1072 |
- * will be thrown. |
|
1073 |
- * |
|
1074 |
- * @param int|null $year |
|
1075 |
- * @param int|null $month |
|
1076 |
- * @param int|null $day |
|
1077 |
- * @param int|null $hour |
|
1078 |
- * @param int|null $minute |
|
1079 |
- * @param int|null $second |
|
1080 |
- * @param \DateTimeZone|string|null $tz |
|
1081 |
- * |
|
1082 |
- * @throws \Carbon\Exceptions\InvalidDateException|\InvalidArgumentException |
|
1083 |
- * |
|
1084 |
- * @return static|false |
|
1085 |
- */ |
|
1086 |
- public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null); |
|
1087 |
- |
|
1088 |
- /** |
|
1089 |
- * Get/set the day of year. |
|
1090 |
- * |
|
1091 |
- * @param int|null $value new value for day of year if using as setter. |
|
1092 |
- * |
|
1093 |
- * @return static|int |
|
1094 |
- */ |
|
1095 |
- public function dayOfYear($value = null); |
|
1096 |
- |
|
1097 |
- /** |
|
1098 |
- * Get the difference as a CarbonInterval instance |
|
1099 |
- * |
|
1100 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1101 |
- * @param bool $absolute Get the absolute of the difference |
|
1102 |
- * |
|
1103 |
- * @return CarbonInterval |
|
1104 |
- */ |
|
1105 |
- public function diffAsCarbonInterval($date = null, $absolute = true); |
|
1106 |
- |
|
1107 |
- /** |
|
1108 |
- * Get the difference by the given interval using a filter closure |
|
1109 |
- * |
|
1110 |
- * @param CarbonInterval $ci An interval to traverse by |
|
1111 |
- * @param Closure $callback |
|
1112 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1113 |
- * @param bool $absolute Get the absolute of the difference |
|
1114 |
- * |
|
1115 |
- * @return int |
|
1116 |
- */ |
|
1117 |
- public function diffFiltered(CarbonInterval $ci, \Closure $callback, $date = null, $absolute = true); |
|
1118 |
- |
|
1119 |
- /** |
|
1120 |
- * Get the difference in a human readable format in the current locale from current instance to an other |
|
1121 |
- * instance given (or now if null given). |
|
1122 |
- * |
|
1123 |
- * @example |
|
1124 |
- * ``` |
|
1125 |
- * echo Carbon::tomorrow()->diffForHumans() . "\n"; |
|
1126 |
- * echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n"; |
|
1127 |
- * echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n"; |
|
1128 |
- * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n"; |
|
1129 |
- * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n"; |
|
1130 |
- * ``` |
|
1131 |
- * |
|
1132 |
- * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
1133 |
- * if null passed, now will be used as comparison reference; |
|
1134 |
- * if any other type, it will be converted to date and used as reference. |
|
1135 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1136 |
- * - 'syntax' entry (see below) |
|
1137 |
- * - 'short' entry (see below) |
|
1138 |
- * - 'parts' entry (see below) |
|
1139 |
- * - 'options' entry (see below) |
|
1140 |
- * - 'join' entry determines how to join multiple parts of the string |
|
1141 |
- * ` - if $join is a string, it's used as a joiner glue |
|
1142 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1143 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1144 |
- * ` will be used instead of the glue for the last item |
|
1145 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1146 |
- * ` - if $join is missing, a space will be used as glue |
|
1147 |
- * - 'other' entry (see above) |
|
1148 |
- * if int passed, it add modifiers: |
|
1149 |
- * Possible values: |
|
1150 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1151 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1152 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1153 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1154 |
- * @param bool $short displays short format of time units |
|
1155 |
- * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1156 |
- * @param int $options human diff options |
|
1157 |
- * |
|
1158 |
- * @return string |
|
1159 |
- */ |
|
1160 |
- public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
1161 |
- |
|
1162 |
- /** |
|
1163 |
- * Get the difference in days |
|
1164 |
- * |
|
1165 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1166 |
- * @param bool $absolute Get the absolute of the difference |
|
1167 |
- * |
|
1168 |
- * @return int |
|
1169 |
- */ |
|
1170 |
- public function diffInDays($date = null, $absolute = true); |
|
1171 |
- |
|
1172 |
- /** |
|
1173 |
- * Get the difference in days using a filter closure |
|
1174 |
- * |
|
1175 |
- * @param Closure $callback |
|
1176 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1177 |
- * @param bool $absolute Get the absolute of the difference |
|
1178 |
- * |
|
1179 |
- * @return int |
|
1180 |
- */ |
|
1181 |
- public function diffInDaysFiltered(\Closure $callback, $date = null, $absolute = true); |
|
1182 |
- |
|
1183 |
- /** |
|
1184 |
- * Get the difference in hours. |
|
1185 |
- * |
|
1186 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1187 |
- * @param bool $absolute Get the absolute of the difference |
|
1188 |
- * |
|
1189 |
- * @return int |
|
1190 |
- */ |
|
1191 |
- public function diffInHours($date = null, $absolute = true); |
|
1192 |
- |
|
1193 |
- /** |
|
1194 |
- * Get the difference in hours using a filter closure |
|
1195 |
- * |
|
1196 |
- * @param Closure $callback |
|
1197 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1198 |
- * @param bool $absolute Get the absolute of the difference |
|
1199 |
- * |
|
1200 |
- * @return int |
|
1201 |
- */ |
|
1202 |
- public function diffInHoursFiltered(\Closure $callback, $date = null, $absolute = true); |
|
1203 |
- |
|
1204 |
- /** |
|
1205 |
- * Get the difference in microseconds. |
|
1206 |
- * |
|
1207 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1208 |
- * @param bool $absolute Get the absolute of the difference |
|
1209 |
- * |
|
1210 |
- * @return int |
|
1211 |
- */ |
|
1212 |
- public function diffInMicroseconds($date = null, $absolute = true); |
|
1213 |
- |
|
1214 |
- /** |
|
1215 |
- * Get the difference in milliseconds. |
|
1216 |
- * |
|
1217 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1218 |
- * @param bool $absolute Get the absolute of the difference |
|
1219 |
- * |
|
1220 |
- * @return int |
|
1221 |
- */ |
|
1222 |
- public function diffInMilliseconds($date = null, $absolute = true); |
|
1223 |
- |
|
1224 |
- /** |
|
1225 |
- * Get the difference in minutes. |
|
1226 |
- * |
|
1227 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1228 |
- * @param bool $absolute Get the absolute of the difference |
|
1229 |
- * |
|
1230 |
- * @return int |
|
1231 |
- */ |
|
1232 |
- public function diffInMinutes($date = null, $absolute = true); |
|
1233 |
- |
|
1234 |
- /** |
|
1235 |
- * Get the difference in months |
|
1236 |
- * |
|
1237 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1238 |
- * @param bool $absolute Get the absolute of the difference |
|
1239 |
- * |
|
1240 |
- * @return int |
|
1241 |
- */ |
|
1242 |
- public function diffInMonths($date = null, $absolute = true); |
|
1243 |
- |
|
1244 |
- /** |
|
1245 |
- * Get the difference in hours using timestamps. |
|
1246 |
- * |
|
1247 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1248 |
- * @param bool $absolute Get the absolute of the difference |
|
1249 |
- * |
|
1250 |
- * @return int |
|
1251 |
- */ |
|
1252 |
- public function diffInRealHours($date = null, $absolute = true); |
|
1253 |
- |
|
1254 |
- /** |
|
1255 |
- * Get the difference in microseconds using timestamps. |
|
1256 |
- * |
|
1257 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1258 |
- * @param bool $absolute Get the absolute of the difference |
|
1259 |
- * |
|
1260 |
- * @return int |
|
1261 |
- */ |
|
1262 |
- public function diffInRealMicroseconds($date = null, $absolute = true); |
|
1263 |
- |
|
1264 |
- /** |
|
1265 |
- * Get the difference in milliseconds using timestamps. |
|
1266 |
- * |
|
1267 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1268 |
- * @param bool $absolute Get the absolute of the difference |
|
1269 |
- * |
|
1270 |
- * @return int |
|
1271 |
- */ |
|
1272 |
- public function diffInRealMilliseconds($date = null, $absolute = true); |
|
1273 |
- |
|
1274 |
- /** |
|
1275 |
- * Get the difference in minutes using timestamps. |
|
1276 |
- * |
|
1277 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1278 |
- * @param bool $absolute Get the absolute of the difference |
|
1279 |
- * |
|
1280 |
- * @return int |
|
1281 |
- */ |
|
1282 |
- public function diffInRealMinutes($date = null, $absolute = true); |
|
1283 |
- |
|
1284 |
- /** |
|
1285 |
- * Get the difference in seconds using timestamps. |
|
1286 |
- * |
|
1287 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1288 |
- * @param bool $absolute Get the absolute of the difference |
|
1289 |
- * |
|
1290 |
- * @return int |
|
1291 |
- */ |
|
1292 |
- public function diffInRealSeconds($date = null, $absolute = true); |
|
1293 |
- |
|
1294 |
- /** |
|
1295 |
- * Get the difference in seconds. |
|
1296 |
- * |
|
1297 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1298 |
- * @param bool $absolute Get the absolute of the difference |
|
1299 |
- * |
|
1300 |
- * @return int |
|
1301 |
- */ |
|
1302 |
- public function diffInSeconds($date = null, $absolute = true); |
|
1303 |
- |
|
1304 |
- /** |
|
1305 |
- * Get the difference in weekdays |
|
1306 |
- * |
|
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 diffInWeekdays($date = null, $absolute = true); |
|
1313 |
- |
|
1314 |
- /** |
|
1315 |
- * Get the difference in weekend days using a filter |
|
1316 |
- * |
|
1317 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1318 |
- * @param bool $absolute Get the absolute of the difference |
|
1319 |
- * |
|
1320 |
- * @return int |
|
1321 |
- */ |
|
1322 |
- public function diffInWeekendDays($date = null, $absolute = true); |
|
1323 |
- |
|
1324 |
- /** |
|
1325 |
- * Get the difference in weeks |
|
1326 |
- * |
|
1327 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1328 |
- * @param bool $absolute Get the absolute of the difference |
|
1329 |
- * |
|
1330 |
- * @return int |
|
1331 |
- */ |
|
1332 |
- public function diffInWeeks($date = null, $absolute = true); |
|
1333 |
- |
|
1334 |
- /** |
|
1335 |
- * Get the difference in years |
|
1336 |
- * |
|
1337 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1338 |
- * @param bool $absolute Get the absolute of the difference |
|
1339 |
- * |
|
1340 |
- * @return int |
|
1341 |
- */ |
|
1342 |
- public function diffInYears($date = null, $absolute = true); |
|
1343 |
- |
|
1344 |
- /** |
|
1345 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
1346 |
- * You should rather use the ->settings() method. |
|
1347 |
- * @see settings |
|
1348 |
- * |
|
1349 |
- * @param int $humanDiffOption |
|
1350 |
- */ |
|
1351 |
- public static function disableHumanDiffOption($humanDiffOption); |
|
1352 |
- |
|
1353 |
- /** |
|
1354 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
1355 |
- * You should rather use the ->settings() method. |
|
1356 |
- * @see settings |
|
1357 |
- * |
|
1358 |
- * @param int $humanDiffOption |
|
1359 |
- */ |
|
1360 |
- public static function enableHumanDiffOption($humanDiffOption); |
|
1361 |
- |
|
1362 |
- /** |
|
1363 |
- * Modify to end of current given unit. |
|
1364 |
- * |
|
1365 |
- * @example |
|
1366 |
- * ``` |
|
1367 |
- * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
1368 |
- * ->startOf('month') |
|
1369 |
- * ->endOf('week', Carbon::FRIDAY); |
|
1370 |
- * ``` |
|
1371 |
- * |
|
1372 |
- * @param string $unit |
|
1373 |
- * @param array<int, mixed> $params |
|
1374 |
- * |
|
1375 |
- * @return static |
|
1376 |
- */ |
|
1377 |
- public function endOf($unit, ...$params); |
|
1378 |
- |
|
1379 |
- /** |
|
1380 |
- * Resets the date to end of the century and time to 23:59:59.999999 |
|
1381 |
- * |
|
1382 |
- * @example |
|
1383 |
- * ``` |
|
1384 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury(); |
|
1385 |
- * ``` |
|
1386 |
- * |
|
1387 |
- * @return static |
|
1388 |
- */ |
|
1389 |
- public function endOfCentury(); |
|
1390 |
- |
|
1391 |
- /** |
|
1392 |
- * Resets the time to 23:59:59.999999 end of day |
|
1393 |
- * |
|
1394 |
- * @example |
|
1395 |
- * ``` |
|
1396 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfDay(); |
|
1397 |
- * ``` |
|
1398 |
- * |
|
1399 |
- * @return static |
|
1400 |
- */ |
|
1401 |
- public function endOfDay(); |
|
1402 |
- |
|
1403 |
- /** |
|
1404 |
- * Resets the date to end of the decade and time to 23:59:59.999999 |
|
1405 |
- * |
|
1406 |
- * @example |
|
1407 |
- * ``` |
|
1408 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade(); |
|
1409 |
- * ``` |
|
1410 |
- * |
|
1411 |
- * @return static |
|
1412 |
- */ |
|
1413 |
- public function endOfDecade(); |
|
1414 |
- |
|
1415 |
- /** |
|
1416 |
- * Modify to end of current hour, minutes and seconds become 59 |
|
1417 |
- * |
|
1418 |
- * @example |
|
1419 |
- * ``` |
|
1420 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfHour(); |
|
1421 |
- * ``` |
|
1422 |
- * |
|
1423 |
- * @return static |
|
1424 |
- */ |
|
1425 |
- public function endOfHour(); |
|
1426 |
- |
|
1427 |
- /** |
|
1428 |
- * Resets the date to end of the century and time to 23:59:59.999999 |
|
1429 |
- * |
|
1430 |
- * @example |
|
1431 |
- * ``` |
|
1432 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium(); |
|
1433 |
- * ``` |
|
1434 |
- * |
|
1435 |
- * @return static |
|
1436 |
- */ |
|
1437 |
- public function endOfMillennium(); |
|
1438 |
- |
|
1439 |
- /** |
|
1440 |
- * Modify to end of current minute, seconds become 59 |
|
1441 |
- * |
|
1442 |
- * @example |
|
1443 |
- * ``` |
|
1444 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute(); |
|
1445 |
- * ``` |
|
1446 |
- * |
|
1447 |
- * @return static |
|
1448 |
- */ |
|
1449 |
- public function endOfMinute(); |
|
1450 |
- |
|
1451 |
- /** |
|
1452 |
- * Resets the date to end of the month and time to 23:59:59.999999 |
|
1453 |
- * |
|
1454 |
- * @example |
|
1455 |
- * ``` |
|
1456 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth(); |
|
1457 |
- * ``` |
|
1458 |
- * |
|
1459 |
- * @return static |
|
1460 |
- */ |
|
1461 |
- public function endOfMonth(); |
|
1462 |
- |
|
1463 |
- /** |
|
1464 |
- * Resets the date to end of the quarter and time to 23:59:59.999999 |
|
1465 |
- * |
|
1466 |
- * @example |
|
1467 |
- * ``` |
|
1468 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter(); |
|
1469 |
- * ``` |
|
1470 |
- * |
|
1471 |
- * @return static |
|
1472 |
- */ |
|
1473 |
- public function endOfQuarter(); |
|
1474 |
- |
|
1475 |
- /** |
|
1476 |
- * Modify to end of current second, microseconds become 999999 |
|
1477 |
- * |
|
1478 |
- * @example |
|
1479 |
- * ``` |
|
1480 |
- * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
1481 |
- * ->endOfSecond() |
|
1482 |
- * ->format('H:i:s.u'); |
|
1483 |
- * ``` |
|
1484 |
- * |
|
1485 |
- * @return static |
|
1486 |
- */ |
|
1487 |
- public function endOfSecond(); |
|
1488 |
- |
|
1489 |
- /** |
|
1490 |
- * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999 |
|
1491 |
- * |
|
1492 |
- * @example |
|
1493 |
- * ``` |
|
1494 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n"; |
|
1495 |
- * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n"; |
|
1496 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n"; |
|
1497 |
- * ``` |
|
1498 |
- * |
|
1499 |
- * @param int $weekEndsAt optional start allow you to specify the day of week to use to end the week |
|
1500 |
- * |
|
1501 |
- * @return static |
|
1502 |
- */ |
|
1503 |
- public function endOfWeek($weekEndsAt = null); |
|
1504 |
- |
|
1505 |
- /** |
|
1506 |
- * Resets the date to end of the year and time to 23:59:59.999999 |
|
1507 |
- * |
|
1508 |
- * @example |
|
1509 |
- * ``` |
|
1510 |
- * echo Carbon::parse('2018-07-25 12:45:16')->endOfYear(); |
|
1511 |
- * ``` |
|
1512 |
- * |
|
1513 |
- * @return static |
|
1514 |
- */ |
|
1515 |
- public function endOfYear(); |
|
1516 |
- |
|
1517 |
- /** |
|
1518 |
- * Determines if the instance is equal to another |
|
1519 |
- * |
|
1520 |
- * @example |
|
1521 |
- * ``` |
|
1522 |
- * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true |
|
1523 |
- * Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true |
|
1524 |
- * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false |
|
1525 |
- * ``` |
|
1526 |
- * |
|
1527 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
1528 |
- * |
|
1529 |
- * @see equalTo() |
|
1530 |
- * |
|
1531 |
- * @return bool |
|
1532 |
- */ |
|
1533 |
- public function eq($date): bool; |
|
1534 |
- |
|
1535 |
- /** |
|
1536 |
- * Determines if the instance is equal to another |
|
1537 |
- * |
|
1538 |
- * @example |
|
1539 |
- * ``` |
|
1540 |
- * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true |
|
1541 |
- * Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true |
|
1542 |
- * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false |
|
1543 |
- * ``` |
|
1544 |
- * |
|
1545 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
1546 |
- * |
|
1547 |
- * @return bool |
|
1548 |
- */ |
|
1549 |
- public function equalTo($date): bool; |
|
1550 |
- |
|
1551 |
- /** |
|
1552 |
- * Set the current locale to the given, execute the passed function, reset the locale to previous one, |
|
1553 |
- * then return the result of the closure (or null if the closure was void). |
|
1554 |
- * |
|
1555 |
- * @param string $locale locale ex. en |
|
1556 |
- * @param callable $func |
|
1557 |
- * |
|
1558 |
- * @return mixed |
|
1559 |
- */ |
|
1560 |
- public static function executeWithLocale($locale, $func); |
|
1561 |
- |
|
1562 |
- /** |
|
1563 |
- * Get the farthest date from the instance (second-precision). |
|
1564 |
- * |
|
1565 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
1566 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
1567 |
- * |
|
1568 |
- * @return static |
|
1569 |
- */ |
|
1570 |
- public function farthest($date1, $date2); |
|
1571 |
- |
|
1572 |
- /** |
|
1573 |
- * Modify to the first occurrence of a given day of the week |
|
1574 |
- * in the current month. If no dayOfWeek is provided, modify to the |
|
1575 |
- * first day of the current month. Use the supplied constants |
|
1576 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1577 |
- * |
|
1578 |
- * @param int|null $dayOfWeek |
|
1579 |
- * |
|
1580 |
- * @return static |
|
1581 |
- */ |
|
1582 |
- public function firstOfMonth($dayOfWeek = null); |
|
1583 |
- |
|
1584 |
- /** |
|
1585 |
- * Modify to the first occurrence of a given day of the week |
|
1586 |
- * in the current quarter. If no dayOfWeek is provided, modify to the |
|
1587 |
- * first day of the current quarter. Use the supplied constants |
|
1588 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1589 |
- * |
|
1590 |
- * @param int|null $dayOfWeek day of the week default null |
|
1591 |
- * |
|
1592 |
- * @return static |
|
1593 |
- */ |
|
1594 |
- public function firstOfQuarter($dayOfWeek = null); |
|
1595 |
- |
|
1596 |
- /** |
|
1597 |
- * Modify to the first occurrence of a given day of the week |
|
1598 |
- * in the current year. If no dayOfWeek is provided, modify to the |
|
1599 |
- * first day of the current year. Use the supplied constants |
|
1600 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1601 |
- * |
|
1602 |
- * @param int|null $dayOfWeek day of the week default null |
|
1603 |
- * |
|
1604 |
- * @return static |
|
1605 |
- */ |
|
1606 |
- public function firstOfYear($dayOfWeek = null); |
|
1607 |
- |
|
1608 |
- /** |
|
1609 |
- * Get the difference in days as float (microsecond-precision). |
|
1610 |
- * |
|
1611 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1612 |
- * @param bool $absolute Get the absolute of the difference |
|
1613 |
- * |
|
1614 |
- * @return float |
|
1615 |
- */ |
|
1616 |
- public function floatDiffInDays($date = null, $absolute = true); |
|
1617 |
- |
|
1618 |
- /** |
|
1619 |
- * Get the difference in hours as float (microsecond-precision). |
|
1620 |
- * |
|
1621 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1622 |
- * @param bool $absolute Get the absolute of the difference |
|
1623 |
- * |
|
1624 |
- * @return float |
|
1625 |
- */ |
|
1626 |
- public function floatDiffInHours($date = null, $absolute = true); |
|
1627 |
- |
|
1628 |
- /** |
|
1629 |
- * Get the difference in minutes as float (microsecond-precision). |
|
1630 |
- * |
|
1631 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1632 |
- * @param bool $absolute Get the absolute of the difference |
|
1633 |
- * |
|
1634 |
- * @return float |
|
1635 |
- */ |
|
1636 |
- public function floatDiffInMinutes($date = null, $absolute = true); |
|
1637 |
- |
|
1638 |
- /** |
|
1639 |
- * Get the difference in months as float (microsecond-precision). |
|
1640 |
- * |
|
1641 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1642 |
- * @param bool $absolute Get the absolute of the difference |
|
1643 |
- * |
|
1644 |
- * @return float |
|
1645 |
- */ |
|
1646 |
- public function floatDiffInMonths($date = null, $absolute = true); |
|
1647 |
- |
|
1648 |
- /** |
|
1649 |
- * Get the difference in days as float (microsecond-precision). |
|
1650 |
- * |
|
1651 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1652 |
- * @param bool $absolute Get the absolute of the difference |
|
1653 |
- * |
|
1654 |
- * @return float |
|
1655 |
- */ |
|
1656 |
- public function floatDiffInRealDays($date = null, $absolute = true); |
|
1657 |
- |
|
1658 |
- /** |
|
1659 |
- * Get the difference in hours as float (microsecond-precision) using timestamps. |
|
1660 |
- * |
|
1661 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1662 |
- * @param bool $absolute Get the absolute of the difference |
|
1663 |
- * |
|
1664 |
- * @return float |
|
1665 |
- */ |
|
1666 |
- public function floatDiffInRealHours($date = null, $absolute = true); |
|
1667 |
- |
|
1668 |
- /** |
|
1669 |
- * Get the difference in minutes as float (microsecond-precision) using timestamps. |
|
1670 |
- * |
|
1671 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1672 |
- * @param bool $absolute Get the absolute of the difference |
|
1673 |
- * |
|
1674 |
- * @return float |
|
1675 |
- */ |
|
1676 |
- public function floatDiffInRealMinutes($date = null, $absolute = true); |
|
1677 |
- |
|
1678 |
- /** |
|
1679 |
- * Get the difference in months as float (microsecond-precision) using timestamps. |
|
1680 |
- * |
|
1681 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1682 |
- * @param bool $absolute Get the absolute of the difference |
|
1683 |
- * |
|
1684 |
- * @return float |
|
1685 |
- */ |
|
1686 |
- public function floatDiffInRealMonths($date = null, $absolute = true); |
|
1687 |
- |
|
1688 |
- /** |
|
1689 |
- * Get the difference in seconds as float (microsecond-precision) using timestamps. |
|
1690 |
- * |
|
1691 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1692 |
- * @param bool $absolute Get the absolute of the difference |
|
1693 |
- * |
|
1694 |
- * @return float |
|
1695 |
- */ |
|
1696 |
- public function floatDiffInRealSeconds($date = null, $absolute = true); |
|
1697 |
- |
|
1698 |
- /** |
|
1699 |
- * Get the difference in year as float (microsecond-precision) using timestamps. |
|
1700 |
- * |
|
1701 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1702 |
- * @param bool $absolute Get the absolute of the difference |
|
1703 |
- * |
|
1704 |
- * @return float |
|
1705 |
- */ |
|
1706 |
- public function floatDiffInRealYears($date = null, $absolute = true); |
|
1707 |
- |
|
1708 |
- /** |
|
1709 |
- * Get the difference in seconds as float (microsecond-precision). |
|
1710 |
- * |
|
1711 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1712 |
- * @param bool $absolute Get the absolute of the difference |
|
1713 |
- * |
|
1714 |
- * @return float |
|
1715 |
- */ |
|
1716 |
- public function floatDiffInSeconds($date = null, $absolute = true); |
|
1717 |
- |
|
1718 |
- /** |
|
1719 |
- * Get the difference in year as float (microsecond-precision). |
|
1720 |
- * |
|
1721 |
- * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1722 |
- * @param bool $absolute Get the absolute of the difference |
|
1723 |
- * |
|
1724 |
- * @return float |
|
1725 |
- */ |
|
1726 |
- public function floatDiffInYears($date = null, $absolute = true); |
|
1727 |
- |
|
1728 |
- /** |
|
1729 |
- * Round the current instance second with given precision if specified. |
|
1730 |
- * |
|
1731 |
- * @param float|int $precision |
|
1732 |
- * |
|
1733 |
- * @return CarbonInterface |
|
1734 |
- */ |
|
1735 |
- public function floor($precision = 1); |
|
1736 |
- |
|
1737 |
- /** |
|
1738 |
- * Truncate the current instance at the given unit with given precision if specified. |
|
1739 |
- * |
|
1740 |
- * @param string $unit |
|
1741 |
- * @param float|int $precision |
|
1742 |
- * |
|
1743 |
- * @return CarbonInterface |
|
1744 |
- */ |
|
1745 |
- public function floorUnit($unit, $precision = 1); |
|
1746 |
- |
|
1747 |
- /** |
|
1748 |
- * Truncate the current instance week. |
|
1749 |
- * |
|
1750 |
- * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
1751 |
- * |
|
1752 |
- * @return CarbonInterface |
|
1753 |
- */ |
|
1754 |
- public function floorWeek($weekStartsAt = null); |
|
1755 |
- |
|
1756 |
- /** |
|
1757 |
- * Format the instance with the current locale. You can set the current |
|
1758 |
- * locale using setlocale() http://php.net/setlocale. |
|
1759 |
- * |
|
1760 |
- * @param string $format |
|
1761 |
- * |
|
1762 |
- * @return string |
|
1763 |
- */ |
|
1764 |
- public function formatLocalized($format); |
|
1765 |
- |
|
1766 |
- /** |
|
1767 |
- * @alias diffForHumans |
|
1768 |
- * |
|
1769 |
- * Get the difference in a human readable format in the current locale from current instance to an other |
|
1770 |
- * instance given (or now if null given). |
|
1771 |
- * |
|
1772 |
- * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
1773 |
- * if null passed, now will be used as comparison reference; |
|
1774 |
- * if any other type, it will be converted to date and used as reference. |
|
1775 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1776 |
- * - 'syntax' entry (see below) |
|
1777 |
- * - 'short' entry (see below) |
|
1778 |
- * - 'parts' entry (see below) |
|
1779 |
- * - 'options' entry (see below) |
|
1780 |
- * - 'join' entry determines how to join multiple parts of the string |
|
1781 |
- * ` - if $join is a string, it's used as a joiner glue |
|
1782 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1783 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1784 |
- * ` will be used instead of the glue for the last item |
|
1785 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1786 |
- * ` - if $join is missing, a space will be used as glue |
|
1787 |
- * - 'other' entry (see above) |
|
1788 |
- * if int passed, it add modifiers: |
|
1789 |
- * Possible values: |
|
1790 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1791 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1792 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1793 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1794 |
- * @param bool $short displays short format of time units |
|
1795 |
- * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1796 |
- * @param int $options human diff options |
|
1797 |
- * |
|
1798 |
- * @return string |
|
1799 |
- */ |
|
1800 |
- public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
1801 |
- |
|
1802 |
- /** |
|
1803 |
- * Get the difference in a human readable format in the current locale from current |
|
1804 |
- * instance to now. |
|
1805 |
- * |
|
1806 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1807 |
- * - 'syntax' entry (see below) |
|
1808 |
- * - 'short' entry (see below) |
|
1809 |
- * - 'parts' entry (see below) |
|
1810 |
- * - 'options' entry (see below) |
|
1811 |
- * - 'join' entry determines how to join multiple parts of the string |
|
1812 |
- * ` - if $join is a string, it's used as a joiner glue |
|
1813 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1814 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1815 |
- * ` will be used instead of the glue for the last item |
|
1816 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1817 |
- * ` - if $join is missing, a space will be used as glue |
|
1818 |
- * if int passed, it add modifiers: |
|
1819 |
- * Possible values: |
|
1820 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1821 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1822 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1823 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1824 |
- * @param bool $short displays short format of time units |
|
1825 |
- * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1826 |
- * @param int $options human diff options |
|
1827 |
- * |
|
1828 |
- * @return string |
|
1829 |
- */ |
|
1830 |
- public function fromNow($syntax = null, $short = false, $parts = 1, $options = null); |
|
1831 |
- |
|
1832 |
- /** |
|
1833 |
- * Create an instance from a serialized string. |
|
1834 |
- * |
|
1835 |
- * @param string $value |
|
1836 |
- * |
|
1837 |
- * @throws \InvalidArgumentException |
|
1838 |
- * |
|
1839 |
- * @return static |
|
1840 |
- */ |
|
1841 |
- public static function fromSerialized($value); |
|
1842 |
- |
|
1843 |
- /** |
|
1844 |
- * Register a custom macro. |
|
1845 |
- * |
|
1846 |
- * @param object|callable $macro |
|
1847 |
- * @param int $priority marco with higher priority is tried first |
|
1848 |
- * |
|
1849 |
- * @return void |
|
1850 |
- */ |
|
1851 |
- public static function genericMacro($macro, $priority = 0); |
|
1852 |
- |
|
1853 |
- /** |
|
1854 |
- * Get a part of the Carbon object |
|
1855 |
- * |
|
1856 |
- * @param string $name |
|
1857 |
- * |
|
1858 |
- * @throws InvalidArgumentException|ReflectionException |
|
1859 |
- * |
|
1860 |
- * @return string|int|bool|\DateTimeZone|null |
|
1861 |
- */ |
|
1862 |
- public function get($name); |
|
1863 |
- |
|
1864 |
- /** |
|
1865 |
- * Returns the alternative number if available in the current locale. |
|
1866 |
- * |
|
1867 |
- * @param string $key date property |
|
1868 |
- * |
|
1869 |
- * @return string |
|
1870 |
- */ |
|
1871 |
- public function getAltNumber(string $key): string; |
|
1872 |
- |
|
1873 |
- /** |
|
1874 |
- * Returns the list of internally available locales and already loaded custom locales. |
|
1875 |
- * (It will ignore custom translator dynamic loading.) |
|
1876 |
- * |
|
1877 |
- * @return array |
|
1878 |
- */ |
|
1879 |
- public static function getAvailableLocales(); |
|
1880 |
- |
|
1881 |
- /** |
|
1882 |
- * Returns list of Language object for each available locale. This object allow you to get the ISO name, native |
|
1883 |
- * name, region and variant of the locale. |
|
1884 |
- * |
|
1885 |
- * @return Language[] |
|
1886 |
- */ |
|
1887 |
- public static function getAvailableLocalesInfo(); |
|
1888 |
- |
|
1889 |
- /** |
|
1890 |
- * Returns list of calendar formats for ISO formatting. |
|
1891 |
- * |
|
1892 |
- * @param string|null $locale current locale used if null |
|
1893 |
- * |
|
1894 |
- * @return array |
|
1895 |
- */ |
|
1896 |
- public function getCalendarFormats($locale = null); |
|
1897 |
- |
|
1898 |
- /** |
|
1899 |
- * Get the days of the week |
|
1900 |
- * |
|
1901 |
- * @return array |
|
1902 |
- */ |
|
1903 |
- public static function getDays(); |
|
1904 |
- |
|
1905 |
- /** |
|
1906 |
- * Get the fallback locale. |
|
1907 |
- * |
|
1908 |
- * @see https://symfony.com/doc/current/components/translation.html#fallback-locales |
|
1909 |
- * |
|
1910 |
- * @return string|null |
|
1911 |
- */ |
|
1912 |
- public static function getFallbackLocale(); |
|
1913 |
- |
|
1914 |
- /** |
|
1915 |
- * List of replacements from date() format to isoFormat(). |
|
1916 |
- * |
|
1917 |
- * @return array |
|
1918 |
- */ |
|
1919 |
- public static function getFormatsToIsoReplacements(); |
|
1920 |
- |
|
1921 |
- /** |
|
1922 |
- * Return default humanDiff() options (merged flags as integer). |
|
1923 |
- * |
|
1924 |
- * @return int |
|
1925 |
- */ |
|
1926 |
- public static function getHumanDiffOptions(); |
|
1927 |
- |
|
1928 |
- /** |
|
1929 |
- * Returns list of locale formats for ISO formatting. |
|
1930 |
- * |
|
1931 |
- * @param string|null $locale current locale used if null |
|
1932 |
- * |
|
1933 |
- * @return array |
|
1934 |
- */ |
|
1935 |
- public function getIsoFormats($locale = null); |
|
1936 |
- |
|
1937 |
- /** |
|
1938 |
- * Returns list of locale units for ISO formatting. |
|
1939 |
- * |
|
1940 |
- * @return array |
|
1941 |
- */ |
|
1942 |
- public static function getIsoUnits(); |
|
1943 |
- |
|
1944 |
- /** |
|
1945 |
- * {@inheritdoc} |
|
1946 |
- */ |
|
1947 |
- public static function getLastErrors(); |
|
1948 |
- |
|
1949 |
- /** |
|
1950 |
- * Get the translator of the current instance or the default if none set. |
|
1951 |
- * |
|
1952 |
- * @return \Symfony\Component\Translation\TranslatorInterface |
|
1953 |
- */ |
|
1954 |
- public function getLocalTranslator(); |
|
1955 |
- |
|
1956 |
- /** |
|
1957 |
- * Get the current translator locale. |
|
1958 |
- * |
|
1959 |
- * @return string |
|
1960 |
- */ |
|
1961 |
- public static function getLocale(); |
|
1962 |
- |
|
1963 |
- /** |
|
1964 |
- * get midday/noon hour |
|
1965 |
- * |
|
1966 |
- * @return int |
|
1967 |
- */ |
|
1968 |
- public static function getMidDayAt(); |
|
1969 |
- |
|
1970 |
- /** |
|
1971 |
- * Returns the offset hour and minute formatted with +/- and a given separator (":" by default). |
|
1972 |
- * For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first |
|
1973 |
- * argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something |
|
1974 |
- * like "-12:00". |
|
1975 |
- * |
|
1976 |
- * @param string $separator string to place between hours and minutes (":" by default) |
|
1977 |
- * |
|
1978 |
- * @return string |
|
1979 |
- */ |
|
1980 |
- public function getOffsetString($separator = ':'); |
|
1981 |
- |
|
1982 |
- /** |
|
1983 |
- * Returns a unit of the instance padded with 0 by default or any other string if specified. |
|
1984 |
- * |
|
1985 |
- * @param string $unit Carbon unit name |
|
1986 |
- * @param int $length Length of the output (2 by default) |
|
1987 |
- * @param string $padString String to use for padding ("0" by default) |
|
1988 |
- * @param int $padType Side(s) to pad (STR_PAD_LEFT by default) |
|
1989 |
- * |
|
1990 |
- * @return string |
|
1991 |
- */ |
|
1992 |
- public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = 0); |
|
1993 |
- |
|
1994 |
- /** |
|
1995 |
- * Returns a timestamp rounded with the given precision (6 by default). |
|
1996 |
- * |
|
1997 |
- * @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision) |
|
1998 |
- * @example getPreciseTimestamp(6) 1532087464437474 |
|
1999 |
- * @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision) |
|
2000 |
- * @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision) |
|
2001 |
- * @example getPreciseTimestamp(3) 1532087464437 (millisecond precision) |
|
2002 |
- * @example getPreciseTimestamp(2) 153208746444 (1/100 second precision) |
|
2003 |
- * @example getPreciseTimestamp(1) 15320874644 (1/10 second precision) |
|
2004 |
- * @example getPreciseTimestamp(0) 1532087464 (second precision) |
|
2005 |
- * @example getPreciseTimestamp(-1) 153208746 (10 second precision) |
|
2006 |
- * @example getPreciseTimestamp(-2) 15320875 (100 second precision) |
|
2007 |
- * |
|
2008 |
- * @param int $precision |
|
2009 |
- * |
|
2010 |
- * @return float |
|
2011 |
- */ |
|
2012 |
- public function getPreciseTimestamp($precision = 6); |
|
2013 |
- |
|
2014 |
- /** |
|
2015 |
- * Returns current local settings. |
|
2016 |
- * |
|
2017 |
- * @return array |
|
2018 |
- */ |
|
2019 |
- public function getSettings(); |
|
2020 |
- |
|
2021 |
- /** |
|
2022 |
- * Get the Carbon instance (real or mock) to be returned when a "now" |
|
2023 |
- * instance is created. |
|
2024 |
- * |
|
2025 |
- * @return static the current instance used for testing |
|
2026 |
- */ |
|
2027 |
- public static function getTestNow(); |
|
2028 |
- |
|
2029 |
- /** |
|
2030 |
- * Get the translation of the current week day name (with context for languages with multiple forms). |
|
2031 |
- * |
|
2032 |
- * @param string|null $context whole format string |
|
2033 |
- * @param string $keySuffix "", "_short" or "_min" |
|
2034 |
- * @param string|null $defaultValue default value if translation missing |
|
2035 |
- * |
|
2036 |
- * @return string |
|
2037 |
- */ |
|
2038 |
- public function getTranslatedDayName($context = null, $keySuffix = '', $defaultValue = null); |
|
2039 |
- |
|
2040 |
- /** |
|
2041 |
- * Get the translation of the current abbreviated week day name (with context for languages with multiple forms). |
|
2042 |
- * |
|
2043 |
- * @param string|null $context whole format string |
|
2044 |
- * |
|
2045 |
- * @return string |
|
2046 |
- */ |
|
2047 |
- public function getTranslatedMinDayName($context = null); |
|
2048 |
- |
|
2049 |
- /** |
|
2050 |
- * Get the translation of the current month day name (with context for languages with multiple forms). |
|
2051 |
- * |
|
2052 |
- * @param string|null $context whole format string |
|
2053 |
- * @param string $keySuffix "" or "_short" |
|
2054 |
- * @param string|null $defaultValue default value if translation missing |
|
2055 |
- * |
|
2056 |
- * @return string |
|
2057 |
- */ |
|
2058 |
- public function getTranslatedMonthName($context = null, $keySuffix = '', $defaultValue = null); |
|
2059 |
- |
|
2060 |
- /** |
|
2061 |
- * Get the translation of the current short week day name (with context for languages with multiple forms). |
|
2062 |
- * |
|
2063 |
- * @param string|null $context whole format string |
|
2064 |
- * |
|
2065 |
- * @return string |
|
2066 |
- */ |
|
2067 |
- public function getTranslatedShortDayName($context = null); |
|
2068 |
- |
|
2069 |
- /** |
|
2070 |
- * Get the translation of the current short month day name (with context for languages with multiple forms). |
|
2071 |
- * |
|
2072 |
- * @param string|null $context whole format string |
|
2073 |
- * |
|
2074 |
- * @return string |
|
2075 |
- */ |
|
2076 |
- public function getTranslatedShortMonthName($context = null); |
|
2077 |
- |
|
2078 |
- /** |
|
2079 |
- * Returns raw translation message for a given key. |
|
2080 |
- * |
|
2081 |
- * @param string $key key to find |
|
2082 |
- * @param string|null $locale current locale used if null |
|
2083 |
- * @param string|null $default default value if translation returns the key |
|
2084 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator an optional translator to use |
|
2085 |
- * |
|
2086 |
- * @return string |
|
2087 |
- */ |
|
2088 |
- public function getTranslationMessage(string $key, string $locale = null, string $default = null, $translator = null); |
|
2089 |
- |
|
2090 |
- /** |
|
2091 |
- * Returns raw translation message for a given key. |
|
2092 |
- * |
|
2093 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator the translator to use |
|
2094 |
- * @param string $key key to find |
|
2095 |
- * @param string|null $locale current locale used if null |
|
2096 |
- * @param string|null $default default value if translation returns the key |
|
2097 |
- * |
|
2098 |
- * @return string |
|
2099 |
- */ |
|
2100 |
- public static function getTranslationMessageWith($translator, string $key, string $locale = null, string $default = null); |
|
2101 |
- |
|
2102 |
- /** |
|
2103 |
- * Get the default translator instance in use. |
|
2104 |
- * |
|
2105 |
- * @return \Symfony\Component\Translation\TranslatorInterface |
|
2106 |
- */ |
|
2107 |
- public static function getTranslator(); |
|
2108 |
- |
|
2109 |
- /** |
|
2110 |
- * Get the last day of week |
|
2111 |
- * |
|
2112 |
- * @return int |
|
2113 |
- */ |
|
2114 |
- public static function getWeekEndsAt(); |
|
2115 |
- |
|
2116 |
- /** |
|
2117 |
- * Get the first day of week |
|
2118 |
- * |
|
2119 |
- * @return int |
|
2120 |
- */ |
|
2121 |
- public static function getWeekStartsAt(); |
|
2122 |
- |
|
2123 |
- /** |
|
2124 |
- * Get weekend days |
|
2125 |
- * |
|
2126 |
- * @return array |
|
2127 |
- */ |
|
2128 |
- public static function getWeekendDays(); |
|
2129 |
- |
|
2130 |
- /** |
|
2131 |
- * Determines if the instance is greater (after) than another |
|
2132 |
- * |
|
2133 |
- * @example |
|
2134 |
- * ``` |
|
2135 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false |
|
2136 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:18'); // true |
|
2137 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false |
|
2138 |
- * ``` |
|
2139 |
- * |
|
2140 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2141 |
- * |
|
2142 |
- * @return bool |
|
2143 |
- */ |
|
2144 |
- public function greaterThan($date): bool; |
|
2145 |
- |
|
2146 |
- /** |
|
2147 |
- * Determines if the instance is greater (after) than or equal to another |
|
2148 |
- * |
|
2149 |
- * @example |
|
2150 |
- * ``` |
|
2151 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true |
|
2152 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:18'); // true |
|
2153 |
- * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false |
|
2154 |
- * ``` |
|
2155 |
- * |
|
2156 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2157 |
- * |
|
2158 |
- * @return bool |
|
2159 |
- */ |
|
2160 |
- public function greaterThanOrEqualTo($date): bool; |
|
2161 |
- |
|
2162 |
- /** |
|
2163 |
- * Determines if the instance is greater (after) than another |
|
2164 |
- * |
|
2165 |
- * @example |
|
2166 |
- * ``` |
|
2167 |
- * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false |
|
2168 |
- * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:18'); // true |
|
2169 |
- * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false |
|
2170 |
- * ``` |
|
2171 |
- * |
|
2172 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2173 |
- * |
|
2174 |
- * @see greaterThan() |
|
2175 |
- * |
|
2176 |
- * @return bool |
|
2177 |
- */ |
|
2178 |
- public function gt($date): bool; |
|
2179 |
- |
|
2180 |
- /** |
|
2181 |
- * Determines if the instance is greater (after) than or equal to another |
|
2182 |
- * |
|
2183 |
- * @example |
|
2184 |
- * ``` |
|
2185 |
- * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true |
|
2186 |
- * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:18'); // true |
|
2187 |
- * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false |
|
2188 |
- * ``` |
|
2189 |
- * |
|
2190 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2191 |
- * |
|
2192 |
- * @see greaterThanOrEqualTo() |
|
2193 |
- * |
|
2194 |
- * @return bool |
|
2195 |
- */ |
|
2196 |
- public function gte($date): bool; |
|
2197 |
- |
|
2198 |
- /** |
|
2199 |
- * Checks if the (date)time string is in a given format. |
|
2200 |
- * |
|
2201 |
- * @example |
|
2202 |
- * ``` |
|
2203 |
- * Carbon::hasFormat('11:12:45', 'h:i:s'); // true |
|
2204 |
- * Carbon::hasFormat('13:12:45', 'h:i:s'); // false |
|
2205 |
- * ``` |
|
2206 |
- * |
|
2207 |
- * @SuppressWarnings(PHPMD.EmptyCatchBlock) |
|
2208 |
- * |
|
2209 |
- * @param string $date |
|
2210 |
- * @param string $format |
|
2211 |
- * |
|
2212 |
- * @return bool |
|
2213 |
- */ |
|
2214 |
- public static function hasFormat($date, $format); |
|
2215 |
- |
|
2216 |
- /** |
|
2217 |
- * Checks if macro is registered. |
|
2218 |
- * |
|
2219 |
- * @param string $name |
|
2220 |
- * |
|
2221 |
- * @return bool |
|
2222 |
- */ |
|
2223 |
- public static function hasMacro($name); |
|
2224 |
- |
|
2225 |
- /** |
|
2226 |
- * Determine if a time string will produce a relative date. |
|
2227 |
- * |
|
2228 |
- * @param string $time |
|
2229 |
- * |
|
2230 |
- * @return bool true if time match a relative date, false if absolute or invalid time string |
|
2231 |
- */ |
|
2232 |
- public static function hasRelativeKeywords($time); |
|
2233 |
- |
|
2234 |
- /** |
|
2235 |
- * Determine if there is a valid test instance set. A valid test instance |
|
2236 |
- * is anything that is not null. |
|
2237 |
- * |
|
2238 |
- * @return bool true if there is a test instance, otherwise false |
|
2239 |
- */ |
|
2240 |
- public static function hasTestNow(); |
|
2241 |
- |
|
2242 |
- /** |
|
2243 |
- * Create a Carbon instance from a DateTime one. |
|
2244 |
- * |
|
2245 |
- * @param \DateTimeInterface $date |
|
2246 |
- * |
|
2247 |
- * @return static |
|
2248 |
- */ |
|
2249 |
- public static function instance($date); |
|
2250 |
- |
|
2251 |
- /** |
|
2252 |
- * Returns true if the current date matches the given string. |
|
2253 |
- * |
|
2254 |
- * @example |
|
2255 |
- * ``` |
|
2256 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true |
|
2257 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false |
|
2258 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true |
|
2259 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true |
|
2260 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true |
|
2261 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true |
|
2262 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true |
|
2263 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true |
|
2264 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true |
|
2265 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false |
|
2266 |
- * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true |
|
2267 |
- * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true |
|
2268 |
- * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false |
|
2269 |
- * ``` |
|
2270 |
- * |
|
2271 |
- * @param string $tester day name, month name, hour, date, etc. as string |
|
2272 |
- * |
|
2273 |
- * @return bool |
|
2274 |
- */ |
|
2275 |
- public function is(string $tester); |
|
2276 |
- |
|
2277 |
- /** |
|
2278 |
- * Determines if the instance is greater (after) than another |
|
2279 |
- * |
|
2280 |
- * @example |
|
2281 |
- * ``` |
|
2282 |
- * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false |
|
2283 |
- * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:18'); // true |
|
2284 |
- * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false |
|
2285 |
- * ``` |
|
2286 |
- * |
|
2287 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2288 |
- * |
|
2289 |
- * @see greaterThan() |
|
2290 |
- * |
|
2291 |
- * @return bool |
|
2292 |
- */ |
|
2293 |
- public function isAfter($date): bool; |
|
2294 |
- |
|
2295 |
- /** |
|
2296 |
- * Determines if the instance is less (before) than another |
|
2297 |
- * |
|
2298 |
- * @example |
|
2299 |
- * ``` |
|
2300 |
- * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false |
|
2301 |
- * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:18'); // false |
|
2302 |
- * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true |
|
2303 |
- * ``` |
|
2304 |
- * |
|
2305 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2306 |
- * |
|
2307 |
- * @see lessThan() |
|
2308 |
- * |
|
2309 |
- * @return bool |
|
2310 |
- */ |
|
2311 |
- public function isBefore($date): bool; |
|
2312 |
- |
|
2313 |
- /** |
|
2314 |
- * Determines if the instance is between two others |
|
2315 |
- * |
|
2316 |
- * @example |
|
2317 |
- * ``` |
|
2318 |
- * Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true |
|
2319 |
- * Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false |
|
2320 |
- * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // false |
|
2321 |
- * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', true); // true |
|
2322 |
- * ``` |
|
2323 |
- * |
|
2324 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
2325 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
2326 |
- * @param bool $equal Indicates if an equal to comparison should be done |
|
2327 |
- * |
|
2328 |
- * @return bool |
|
2329 |
- */ |
|
2330 |
- public function isBetween($date1, $date2, $equal = true): bool; |
|
2331 |
- |
|
2332 |
- /** |
|
2333 |
- * Check if its the birthday. Compares the date/month values of the two dates. |
|
2334 |
- * |
|
2335 |
- * @example |
|
2336 |
- * ``` |
|
2337 |
- * Carbon::now()->subYears(5)->isBirthday(); // true |
|
2338 |
- * Carbon::now()->subYears(5)->subDay()->isBirthday(); // false |
|
2339 |
- * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true |
|
2340 |
- * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false |
|
2341 |
- * ``` |
|
2342 |
- * |
|
2343 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. |
|
2344 |
- * |
|
2345 |
- * @return bool |
|
2346 |
- */ |
|
2347 |
- public function isBirthday($date = null); |
|
2348 |
- |
|
2349 |
- /** |
|
2350 |
- * Determines if the instance is in the current unit given. |
|
2351 |
- * |
|
2352 |
- * @example |
|
2353 |
- * ``` |
|
2354 |
- * Carbon::now()->isCurrentUnit('hour'); // true |
|
2355 |
- * Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false |
|
2356 |
- * ``` |
|
2357 |
- * |
|
2358 |
- * @param string $unit The unit to test. |
|
2359 |
- * |
|
2360 |
- * @throws \BadMethodCallException |
|
2361 |
- * |
|
2362 |
- * @return bool |
|
2363 |
- */ |
|
2364 |
- public function isCurrentUnit($unit); |
|
2365 |
- |
|
2366 |
- /** |
|
2367 |
- * Checks if this day is a specific day of the week. |
|
2368 |
- * |
|
2369 |
- * @example |
|
2370 |
- * ``` |
|
2371 |
- * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true |
|
2372 |
- * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false |
|
2373 |
- * Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true |
|
2374 |
- * Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false |
|
2375 |
- * ``` |
|
2376 |
- * |
|
2377 |
- * @param int $dayOfWeek |
|
2378 |
- * |
|
2379 |
- * @return bool |
|
2380 |
- */ |
|
2381 |
- public function isDayOfWeek($dayOfWeek); |
|
2382 |
- |
|
2383 |
- /** |
|
2384 |
- * Check if the instance is end of day. |
|
2385 |
- * |
|
2386 |
- * @example |
|
2387 |
- * ``` |
|
2388 |
- * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true |
|
2389 |
- * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true |
|
2390 |
- * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true |
|
2391 |
- * Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false |
|
2392 |
- * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true |
|
2393 |
- * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false |
|
2394 |
- * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false |
|
2395 |
- * ``` |
|
2396 |
- * |
|
2397 |
- * @param bool $checkMicroseconds check time at microseconds precision |
|
2398 |
- * |
|
2399 |
- * @return bool |
|
2400 |
- */ |
|
2401 |
- public function isEndOfDay($checkMicroseconds = false); |
|
2402 |
- |
|
2403 |
- /** |
|
2404 |
- * Determines if the instance is in the future, ie. greater (after) than now. |
|
2405 |
- * |
|
2406 |
- * @example |
|
2407 |
- * ``` |
|
2408 |
- * Carbon::now()->addHours(5)->isFuture(); // true |
|
2409 |
- * Carbon::now()->subHours(5)->isFuture(); // false |
|
2410 |
- * ``` |
|
2411 |
- * |
|
2412 |
- * @return bool |
|
2413 |
- */ |
|
2414 |
- public function isFuture(); |
|
2415 |
- |
|
2416 |
- /** |
|
2417 |
- * Returns true if the current class/instance is immutable. |
|
2418 |
- * |
|
2419 |
- * @return bool |
|
2420 |
- */ |
|
2421 |
- public static function isImmutable(); |
|
2422 |
- |
|
2423 |
- /** |
|
2424 |
- * Check if today is the last day of the Month |
|
2425 |
- * |
|
2426 |
- * @example |
|
2427 |
- * ``` |
|
2428 |
- * Carbon::parse('2019-02-28')->isLastOfMonth(); // true |
|
2429 |
- * Carbon::parse('2019-03-28')->isLastOfMonth(); // false |
|
2430 |
- * Carbon::parse('2019-03-30')->isLastOfMonth(); // false |
|
2431 |
- * Carbon::parse('2019-03-31')->isLastOfMonth(); // true |
|
2432 |
- * Carbon::parse('2019-04-30')->isLastOfMonth(); // true |
|
2433 |
- * ``` |
|
2434 |
- * |
|
2435 |
- * @return bool |
|
2436 |
- */ |
|
2437 |
- public function isLastOfMonth(); |
|
2438 |
- |
|
2439 |
- /** |
|
2440 |
- * Determines if the instance is a leap year. |
|
2441 |
- * |
|
2442 |
- * @example |
|
2443 |
- * ``` |
|
2444 |
- * Carbon::parse('2020-01-01')->isLeapYear(); // true |
|
2445 |
- * Carbon::parse('2019-01-01')->isLeapYear(); // false |
|
2446 |
- * ``` |
|
2447 |
- * |
|
2448 |
- * @return bool |
|
2449 |
- */ |
|
2450 |
- public function isLeapYear(); |
|
2451 |
- |
|
2452 |
- /** |
|
2453 |
- * Determines if the instance is a long year |
|
2454 |
- * |
|
2455 |
- * @example |
|
2456 |
- * ``` |
|
2457 |
- * Carbon::parse('2015-01-01')->isLongYear(); // true |
|
2458 |
- * Carbon::parse('2016-01-01')->isLongYear(); // false |
|
2459 |
- * ``` |
|
2460 |
- * |
|
2461 |
- * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates |
|
2462 |
- * |
|
2463 |
- * @return bool |
|
2464 |
- */ |
|
2465 |
- public function isLongYear(); |
|
2466 |
- |
|
2467 |
- /** |
|
2468 |
- * Check if the instance is midday. |
|
2469 |
- * |
|
2470 |
- * @example |
|
2471 |
- * ``` |
|
2472 |
- * Carbon::parse('2019-02-28 11:59:59.999999')->isMidday(); // false |
|
2473 |
- * Carbon::parse('2019-02-28 12:00:00')->isMidday(); // true |
|
2474 |
- * Carbon::parse('2019-02-28 12:00:00.999999')->isMidday(); // true |
|
2475 |
- * Carbon::parse('2019-02-28 12:00:01')->isMidday(); // false |
|
2476 |
- * ``` |
|
2477 |
- * |
|
2478 |
- * @return bool |
|
2479 |
- */ |
|
2480 |
- public function isMidday(); |
|
2481 |
- |
|
2482 |
- /** |
|
2483 |
- * Check if the instance is start of day / midnight. |
|
2484 |
- * |
|
2485 |
- * @example |
|
2486 |
- * ``` |
|
2487 |
- * Carbon::parse('2019-02-28 00:00:00')->isMidnight(); // true |
|
2488 |
- * Carbon::parse('2019-02-28 00:00:00.999999')->isMidnight(); // true |
|
2489 |
- * Carbon::parse('2019-02-28 00:00:01')->isMidnight(); // false |
|
2490 |
- * ``` |
|
2491 |
- * |
|
2492 |
- * @return bool |
|
2493 |
- */ |
|
2494 |
- public function isMidnight(); |
|
2495 |
- |
|
2496 |
- /** |
|
2497 |
- * Returns true if a property can be changed via setter. |
|
2498 |
- * |
|
2499 |
- * @param string $unit |
|
2500 |
- * |
|
2501 |
- * @return bool |
|
2502 |
- */ |
|
2503 |
- public static function isModifiableUnit($unit); |
|
2504 |
- |
|
2505 |
- /** |
|
2506 |
- * Returns true if the current class/instance is mutable. |
|
2507 |
- * |
|
2508 |
- * @return bool |
|
2509 |
- */ |
|
2510 |
- public static function isMutable(); |
|
2511 |
- |
|
2512 |
- /** |
|
2513 |
- * Determines if the instance is in the past, ie. less (before) than now. |
|
2514 |
- * |
|
2515 |
- * @example |
|
2516 |
- * ``` |
|
2517 |
- * Carbon::now()->subHours(5)->isPast(); // true |
|
2518 |
- * Carbon::now()->addHours(5)->isPast(); // false |
|
2519 |
- * ``` |
|
2520 |
- * |
|
2521 |
- * @return bool |
|
2522 |
- */ |
|
2523 |
- public function isPast(); |
|
2524 |
- |
|
2525 |
- /** |
|
2526 |
- * Compares the formatted values of the two dates. |
|
2527 |
- * |
|
2528 |
- * @example |
|
2529 |
- * ``` |
|
2530 |
- * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true |
|
2531 |
- * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false |
|
2532 |
- * ``` |
|
2533 |
- * |
|
2534 |
- * @param string $format date formats to compare. |
|
2535 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. |
|
2536 |
- * |
|
2537 |
- * @throws \InvalidArgumentException |
|
2538 |
- * |
|
2539 |
- * @return bool |
|
2540 |
- */ |
|
2541 |
- public function isSameAs($format, $date = null); |
|
2542 |
- |
|
2543 |
- /** |
|
2544 |
- * Checks if the passed in date is in the same month as the instance´s month. |
|
2545 |
- * |
|
2546 |
- * @example |
|
2547 |
- * ``` |
|
2548 |
- * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true |
|
2549 |
- * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false |
|
2550 |
- * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false |
|
2551 |
- * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true |
|
2552 |
- * ``` |
|
2553 |
- * |
|
2554 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. |
|
2555 |
- * @param bool $ofSameYear Check if it is the same month in the same year. |
|
2556 |
- * |
|
2557 |
- * @return bool |
|
2558 |
- */ |
|
2559 |
- public function isSameMonth($date = null, $ofSameYear = true); |
|
2560 |
- |
|
2561 |
- /** |
|
2562 |
- * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). |
|
2563 |
- * |
|
2564 |
- * @example |
|
2565 |
- * ``` |
|
2566 |
- * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true |
|
2567 |
- * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false |
|
2568 |
- * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false |
|
2569 |
- * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true |
|
2570 |
- * ``` |
|
2571 |
- * |
|
2572 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. |
|
2573 |
- * @param bool $ofSameYear Check if it is the same month in the same year. |
|
2574 |
- * |
|
2575 |
- * @return bool |
|
2576 |
- */ |
|
2577 |
- public function isSameQuarter($date = null, $ofSameYear = true); |
|
2578 |
- |
|
2579 |
- /** |
|
2580 |
- * Determines if the instance is in the current unit given. |
|
2581 |
- * |
|
2582 |
- * @example |
|
2583 |
- * ``` |
|
2584 |
- * Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true |
|
2585 |
- * Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false |
|
2586 |
- * ``` |
|
2587 |
- * |
|
2588 |
- * @param string $unit singular unit string |
|
2589 |
- * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. |
|
2590 |
- * |
|
2591 |
- * @throws \InvalidArgumentException |
|
2592 |
- * |
|
2593 |
- * @return bool |
|
2594 |
- */ |
|
2595 |
- public function isSameUnit($unit, $date = null); |
|
2596 |
- |
|
2597 |
- /** |
|
2598 |
- * Check if the instance is start of day / midnight. |
|
2599 |
- * |
|
2600 |
- * @example |
|
2601 |
- * ``` |
|
2602 |
- * Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true |
|
2603 |
- * Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true |
|
2604 |
- * Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false |
|
2605 |
- * Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true |
|
2606 |
- * Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false |
|
2607 |
- * ``` |
|
2608 |
- * |
|
2609 |
- * @param bool $checkMicroseconds check time at microseconds precision |
|
2610 |
- * |
|
2611 |
- * @return bool |
|
2612 |
- */ |
|
2613 |
- public function isStartOfDay($checkMicroseconds = false); |
|
2614 |
- |
|
2615 |
- /** |
|
2616 |
- * Returns true if the strict mode is globally in use, false else. |
|
2617 |
- * (It can be overridden in specific instances.) |
|
2618 |
- * |
|
2619 |
- * @return bool |
|
2620 |
- */ |
|
2621 |
- public static function isStrictModeEnabled(); |
|
2622 |
- |
|
2623 |
- /** |
|
2624 |
- * Determines if the instance is today. |
|
2625 |
- * |
|
2626 |
- * @example |
|
2627 |
- * ``` |
|
2628 |
- * Carbon::today()->isToday(); // true |
|
2629 |
- * Carbon::tomorrow()->isToday(); // false |
|
2630 |
- * ``` |
|
2631 |
- * |
|
2632 |
- * @return bool |
|
2633 |
- */ |
|
2634 |
- public function isToday(); |
|
2635 |
- |
|
2636 |
- /** |
|
2637 |
- * Determines if the instance is tomorrow. |
|
2638 |
- * |
|
2639 |
- * @example |
|
2640 |
- * ``` |
|
2641 |
- * Carbon::tomorrow()->isTomorrow(); // true |
|
2642 |
- * Carbon::yesterday()->isTomorrow(); // false |
|
2643 |
- * ``` |
|
2644 |
- * |
|
2645 |
- * @return bool |
|
2646 |
- */ |
|
2647 |
- public function isTomorrow(); |
|
2648 |
- |
|
2649 |
- /** |
|
2650 |
- * Determines if the instance is a weekday. |
|
2651 |
- * |
|
2652 |
- * @example |
|
2653 |
- * ``` |
|
2654 |
- * Carbon::parse('2019-07-14')->isWeekday(); // false |
|
2655 |
- * Carbon::parse('2019-07-15')->isWeekday(); // true |
|
2656 |
- * ``` |
|
2657 |
- * |
|
2658 |
- * @return bool |
|
2659 |
- */ |
|
2660 |
- public function isWeekday(); |
|
2661 |
- |
|
2662 |
- /** |
|
2663 |
- * Determines if the instance is a weekend day. |
|
2664 |
- * |
|
2665 |
- * @example |
|
2666 |
- * ``` |
|
2667 |
- * Carbon::parse('2019-07-14')->isWeekend(); // true |
|
2668 |
- * Carbon::parse('2019-07-15')->isWeekend(); // false |
|
2669 |
- * ``` |
|
2670 |
- * |
|
2671 |
- * @return bool |
|
2672 |
- */ |
|
2673 |
- public function isWeekend(); |
|
2674 |
- |
|
2675 |
- /** |
|
2676 |
- * Determines if the instance is yesterday. |
|
2677 |
- * |
|
2678 |
- * @example |
|
2679 |
- * ``` |
|
2680 |
- * Carbon::yesterday()->isYesterday(); // true |
|
2681 |
- * Carbon::tomorrow()->isYesterday(); // false |
|
2682 |
- * ``` |
|
2683 |
- * |
|
2684 |
- * @return bool |
|
2685 |
- */ |
|
2686 |
- public function isYesterday(); |
|
2687 |
- |
|
2688 |
- /** |
|
2689 |
- * Format in the current language using ISO replacement patterns. |
|
2690 |
- * |
|
2691 |
- * @param string $format |
|
2692 |
- * @param string|null $originalFormat provide context if a chunk has been passed alone |
|
2693 |
- * |
|
2694 |
- * @return string |
|
2695 |
- */ |
|
2696 |
- public function isoFormat(string $format, string $originalFormat = null): string; |
|
2697 |
- |
|
2698 |
- /** |
|
2699 |
- * Get/set the week number using given first day of week and first |
|
2700 |
- * day of year included in the first week. Or use ISO format if no settings |
|
2701 |
- * given. |
|
2702 |
- * |
|
2703 |
- * @param int|null $week |
|
2704 |
- * @param int|null $dayOfWeek |
|
2705 |
- * @param int|null $dayOfYear |
|
2706 |
- * |
|
2707 |
- * @return int|static |
|
2708 |
- */ |
|
2709 |
- public function isoWeek($week = null, $dayOfWeek = null, $dayOfYear = null); |
|
2710 |
- |
|
2711 |
- /** |
|
2712 |
- * Set/get the week number of year using given first day of week and first |
|
2713 |
- * day of year included in the first week. Or use ISO format if no settings |
|
2714 |
- * given. |
|
2715 |
- * |
|
2716 |
- * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. |
|
2717 |
- * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
2718 |
- * @param int|null $dayOfYear first day of year included in the week #1 |
|
2719 |
- * |
|
2720 |
- * @return int|static |
|
2721 |
- */ |
|
2722 |
- public function isoWeekYear($year = null, $dayOfWeek = null, $dayOfYear = null); |
|
2723 |
- |
|
2724 |
- /** |
|
2725 |
- * Get/set the ISO weekday from 1 (Monday) to 7 (Sunday). |
|
2726 |
- * |
|
2727 |
- * @param int|null $value new value for weekday if using as setter. |
|
2728 |
- * |
|
2729 |
- * @return static|int |
|
2730 |
- */ |
|
2731 |
- public function isoWeekday($value = null); |
|
2732 |
- |
|
2733 |
- /** |
|
2734 |
- * Get the number of weeks of the current week-year using given first day of week and first |
|
2735 |
- * day of year included in the first week. Or use ISO format if no settings |
|
2736 |
- * given. |
|
2737 |
- * |
|
2738 |
- * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
2739 |
- * @param int|null $dayOfYear first day of year included in the week #1 |
|
2740 |
- * |
|
2741 |
- * @return int |
|
2742 |
- */ |
|
2743 |
- public function isoWeeksInYear($dayOfWeek = null, $dayOfYear = null); |
|
2744 |
- |
|
2745 |
- /** |
|
2746 |
- * Prepare the object for JSON serialization. |
|
2747 |
- * |
|
2748 |
- * @return array|string |
|
2749 |
- */ |
|
2750 |
- public function jsonSerialize(); |
|
2751 |
- |
|
2752 |
- /** |
|
2753 |
- * Modify to the last occurrence of a given day of the week |
|
2754 |
- * in the current month. If no dayOfWeek is provided, modify to the |
|
2755 |
- * last day of the current month. Use the supplied constants |
|
2756 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2757 |
- * |
|
2758 |
- * @param int|null $dayOfWeek |
|
2759 |
- * |
|
2760 |
- * @return static |
|
2761 |
- */ |
|
2762 |
- public function lastOfMonth($dayOfWeek = null); |
|
2763 |
- |
|
2764 |
- /** |
|
2765 |
- * Modify to the last occurrence of a given day of the week |
|
2766 |
- * in the current quarter. If no dayOfWeek is provided, modify to the |
|
2767 |
- * last day of the current quarter. Use the supplied constants |
|
2768 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2769 |
- * |
|
2770 |
- * @param int|null $dayOfWeek day of the week default null |
|
2771 |
- * |
|
2772 |
- * @return static |
|
2773 |
- */ |
|
2774 |
- public function lastOfQuarter($dayOfWeek = null); |
|
2775 |
- |
|
2776 |
- /** |
|
2777 |
- * Modify to the last occurrence of a given day of the week |
|
2778 |
- * in the current year. If no dayOfWeek is provided, modify to the |
|
2779 |
- * last day of the current year. Use the supplied constants |
|
2780 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2781 |
- * |
|
2782 |
- * @param int|null $dayOfWeek day of the week default null |
|
2783 |
- * |
|
2784 |
- * @return static |
|
2785 |
- */ |
|
2786 |
- public function lastOfYear($dayOfWeek = null); |
|
2787 |
- |
|
2788 |
- /** |
|
2789 |
- * Determines if the instance is less (before) than another |
|
2790 |
- * |
|
2791 |
- * @example |
|
2792 |
- * ``` |
|
2793 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false |
|
2794 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:18'); // false |
|
2795 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true |
|
2796 |
- * ``` |
|
2797 |
- * |
|
2798 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2799 |
- * |
|
2800 |
- * @return bool |
|
2801 |
- */ |
|
2802 |
- public function lessThan($date): bool; |
|
2803 |
- |
|
2804 |
- /** |
|
2805 |
- * Determines if the instance is less (before) or equal to another |
|
2806 |
- * |
|
2807 |
- * @example |
|
2808 |
- * ``` |
|
2809 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true |
|
2810 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:18'); // false |
|
2811 |
- * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true |
|
2812 |
- * ``` |
|
2813 |
- * |
|
2814 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2815 |
- * |
|
2816 |
- * @return bool |
|
2817 |
- */ |
|
2818 |
- public function lessThanOrEqualTo($date): bool; |
|
2819 |
- |
|
2820 |
- /** |
|
2821 |
- * Get/set the locale for the current instance. |
|
2822 |
- * |
|
2823 |
- * @param string|null $locale |
|
2824 |
- * @param string[] ...$fallbackLocales |
|
2825 |
- * |
|
2826 |
- * @return $this|string |
|
2827 |
- */ |
|
2828 |
- public function locale(string $locale = null, ...$fallbackLocales); |
|
2829 |
- |
|
2830 |
- /** |
|
2831 |
- * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). |
|
2832 |
- * Support is considered enabled if the 3 words are translated in the given locale. |
|
2833 |
- * |
|
2834 |
- * @param string $locale locale ex. en |
|
2835 |
- * |
|
2836 |
- * @return bool |
|
2837 |
- */ |
|
2838 |
- public static function localeHasDiffOneDayWords($locale); |
|
2839 |
- |
|
2840 |
- /** |
|
2841 |
- * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). |
|
2842 |
- * Support is considered enabled if the 4 sentences are translated in the given locale. |
|
2843 |
- * |
|
2844 |
- * @param string $locale locale ex. en |
|
2845 |
- * |
|
2846 |
- * @return bool |
|
2847 |
- */ |
|
2848 |
- public static function localeHasDiffSyntax($locale); |
|
2849 |
- |
|
2850 |
- /** |
|
2851 |
- * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). |
|
2852 |
- * Support is considered enabled if the 2 words are translated in the given locale. |
|
2853 |
- * |
|
2854 |
- * @param string $locale locale ex. en |
|
2855 |
- * |
|
2856 |
- * @return bool |
|
2857 |
- */ |
|
2858 |
- public static function localeHasDiffTwoDayWords($locale); |
|
2859 |
- |
|
2860 |
- /** |
|
2861 |
- * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). |
|
2862 |
- * Support is considered enabled if the 4 sentences are translated in the given locale. |
|
2863 |
- * |
|
2864 |
- * @param string $locale locale ex. en |
|
2865 |
- * |
|
2866 |
- * @return bool |
|
2867 |
- */ |
|
2868 |
- public static function localeHasPeriodSyntax($locale); |
|
2869 |
- |
|
2870 |
- /** |
|
2871 |
- * Returns true if the given locale is internally supported and has short-units support. |
|
2872 |
- * Support is considered enabled if either year, day or hour has a short variant translated. |
|
2873 |
- * |
|
2874 |
- * @param string $locale locale ex. en |
|
2875 |
- * |
|
2876 |
- * @return bool |
|
2877 |
- */ |
|
2878 |
- public static function localeHasShortUnits($locale); |
|
2879 |
- |
|
2880 |
- /** |
|
2881 |
- * Determines if the instance is less (before) than another |
|
2882 |
- * |
|
2883 |
- * @example |
|
2884 |
- * ``` |
|
2885 |
- * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false |
|
2886 |
- * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:18'); // false |
|
2887 |
- * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true |
|
2888 |
- * ``` |
|
2889 |
- * |
|
2890 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2891 |
- * |
|
2892 |
- * @see lessThan() |
|
2893 |
- * |
|
2894 |
- * @return bool |
|
2895 |
- */ |
|
2896 |
- public function lt($date): bool; |
|
2897 |
- |
|
2898 |
- /** |
|
2899 |
- * Determines if the instance is less (before) or equal to another |
|
2900 |
- * |
|
2901 |
- * @example |
|
2902 |
- * ``` |
|
2903 |
- * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true |
|
2904 |
- * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:18'); // false |
|
2905 |
- * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true |
|
2906 |
- * ``` |
|
2907 |
- * |
|
2908 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2909 |
- * |
|
2910 |
- * @see lessThanOrEqualTo() |
|
2911 |
- * |
|
2912 |
- * @return bool |
|
2913 |
- */ |
|
2914 |
- public function lte($date): bool; |
|
2915 |
- |
|
2916 |
- /** |
|
2917 |
- * Register a custom macro. |
|
2918 |
- * |
|
2919 |
- * @example |
|
2920 |
- * ``` |
|
2921 |
- * $userSettings = [ |
|
2922 |
- * 'locale' => 'pt', |
|
2923 |
- * 'timezone' => 'America/Sao_Paulo', |
|
2924 |
- * ]; |
|
2925 |
- * Carbon::macro('userFormat', function () use ($userSettings) { |
|
2926 |
- * return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar(); |
|
2927 |
- * }); |
|
2928 |
- * echo Carbon::yesterday()->hours(11)->userFormat(); |
|
2929 |
- * ``` |
|
2930 |
- * |
|
2931 |
- * @param string $name |
|
2932 |
- * @param object|callable $macro |
|
2933 |
- * |
|
2934 |
- * @return void |
|
2935 |
- */ |
|
2936 |
- public static function macro($name, $macro); |
|
2937 |
- |
|
2938 |
- /** |
|
2939 |
- * Make a Carbon instance from given variable if possible. |
|
2940 |
- * |
|
2941 |
- * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals |
|
2942 |
- * and recurrences). Throw an exception for invalid format, but otherwise return null. |
|
2943 |
- * |
|
2944 |
- * @param mixed $var |
|
2945 |
- * |
|
2946 |
- * @return static|null |
|
2947 |
- */ |
|
2948 |
- public static function make($var); |
|
2949 |
- |
|
2950 |
- /** |
|
2951 |
- * Get the maximum instance between a given instance (default now) and the current instance. |
|
2952 |
- * |
|
2953 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2954 |
- * |
|
2955 |
- * @return static |
|
2956 |
- */ |
|
2957 |
- public function max($date = null); |
|
2958 |
- |
|
2959 |
- /** |
|
2960 |
- * Create a Carbon instance for the greatest supported date. |
|
2961 |
- * |
|
2962 |
- * @return static |
|
2963 |
- */ |
|
2964 |
- public static function maxValue(); |
|
2965 |
- |
|
2966 |
- /** |
|
2967 |
- * Get the maximum instance between a given instance (default now) and the current instance. |
|
2968 |
- * |
|
2969 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2970 |
- * |
|
2971 |
- * @see max() |
|
2972 |
- * |
|
2973 |
- * @return static |
|
2974 |
- */ |
|
2975 |
- public function maximum($date = null); |
|
2976 |
- |
|
2977 |
- /** |
|
2978 |
- * Return the meridiem of the current time in the current locale. |
|
2979 |
- * |
|
2980 |
- * @param bool $isLower if true, returns lowercase variant if available in the current locale. |
|
2981 |
- * |
|
2982 |
- * @return string |
|
2983 |
- */ |
|
2984 |
- public function meridiem(bool $isLower = false): string; |
|
2985 |
- |
|
2986 |
- /** |
|
2987 |
- * Modify to midday, default to self::$midDayAt |
|
2988 |
- * |
|
2989 |
- * @return static |
|
2990 |
- */ |
|
2991 |
- public function midDay(); |
|
2992 |
- |
|
2993 |
- /** |
|
2994 |
- * Get the minimum instance between a given instance (default now) and the current instance. |
|
2995 |
- * |
|
2996 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2997 |
- * |
|
2998 |
- * @return static |
|
2999 |
- */ |
|
3000 |
- public function min($date = null); |
|
3001 |
- |
|
3002 |
- /** |
|
3003 |
- * Create a Carbon instance for the lowest supported date. |
|
3004 |
- * |
|
3005 |
- * @return static |
|
3006 |
- */ |
|
3007 |
- public static function minValue(); |
|
3008 |
- |
|
3009 |
- /** |
|
3010 |
- * Get the minimum instance between a given instance (default now) and the current instance. |
|
3011 |
- * |
|
3012 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3013 |
- * |
|
3014 |
- * @see min() |
|
3015 |
- * |
|
3016 |
- * @return static |
|
3017 |
- */ |
|
3018 |
- public function minimum($date = null); |
|
3019 |
- |
|
3020 |
- /** |
|
3021 |
- * Mix another object into the class. |
|
3022 |
- * |
|
3023 |
- * @example |
|
3024 |
- * ``` |
|
3025 |
- * Carbon::mixin(new class { |
|
3026 |
- * public function addMoon() { |
|
3027 |
- * return function () { |
|
3028 |
- * return $this->addDays(30); |
|
3029 |
- * }; |
|
3030 |
- * } |
|
3031 |
- * public function subMoon() { |
|
3032 |
- * return function () { |
|
3033 |
- * return $this->subDays(30); |
|
3034 |
- * }; |
|
3035 |
- * } |
|
3036 |
- * }); |
|
3037 |
- * $fullMoon = Carbon::create('2018-12-22'); |
|
3038 |
- * $nextFullMoon = $fullMoon->addMoon(); |
|
3039 |
- * $blackMoon = Carbon::create('2019-01-06'); |
|
3040 |
- * $previousBlackMoon = $blackMoon->subMoon(); |
|
3041 |
- * echo "$nextFullMoon\n"; |
|
3042 |
- * echo "$previousBlackMoon\n"; |
|
3043 |
- * ``` |
|
3044 |
- * |
|
3045 |
- * @param object|string $mixin |
|
3046 |
- * |
|
3047 |
- * @throws \ReflectionException |
|
3048 |
- * |
|
3049 |
- * @return void |
|
3050 |
- */ |
|
3051 |
- public static function mixin($mixin); |
|
3052 |
- |
|
3053 |
- /** |
|
3054 |
- * call \DateTime::modify if mutable or \DateTimeImmutable::modify else. |
|
3055 |
- * |
|
3056 |
- * @see https://php.net/manual/en/datetime.modify.php |
|
3057 |
- */ |
|
3058 |
- public function modify($modify); |
|
3059 |
- |
|
3060 |
- /** |
|
3061 |
- * Determines if the instance is not equal to another |
|
3062 |
- * |
|
3063 |
- * @example |
|
3064 |
- * ``` |
|
3065 |
- * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false |
|
3066 |
- * Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false |
|
3067 |
- * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true |
|
3068 |
- * ``` |
|
3069 |
- * |
|
3070 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3071 |
- * |
|
3072 |
- * @see notEqualTo() |
|
3073 |
- * |
|
3074 |
- * @return bool |
|
3075 |
- */ |
|
3076 |
- public function ne($date): bool; |
|
3077 |
- |
|
3078 |
- /** |
|
3079 |
- * Modify to the next occurrence of a given modifier such as a day of |
|
3080 |
- * the week. If no modifier is provided, modify to the next occurrence |
|
3081 |
- * of the current day of the week. Use the supplied constants |
|
3082 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3083 |
- * |
|
3084 |
- * @param string|int|null $modifier |
|
3085 |
- * |
|
3086 |
- * @return static |
|
3087 |
- */ |
|
3088 |
- public function next($modifier = null); |
|
3089 |
- |
|
3090 |
- /** |
|
3091 |
- * Go forward to the next weekday. |
|
3092 |
- * |
|
3093 |
- * @return static |
|
3094 |
- */ |
|
3095 |
- public function nextWeekday(); |
|
3096 |
- |
|
3097 |
- /** |
|
3098 |
- * Go forward to the next weekend day. |
|
3099 |
- * |
|
3100 |
- * @return static |
|
3101 |
- */ |
|
3102 |
- public function nextWeekendDay(); |
|
3103 |
- |
|
3104 |
- /** |
|
3105 |
- * Determines if the instance is not equal to another |
|
3106 |
- * |
|
3107 |
- * @example |
|
3108 |
- * ``` |
|
3109 |
- * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false |
|
3110 |
- * Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false |
|
3111 |
- * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true |
|
3112 |
- * ``` |
|
3113 |
- * |
|
3114 |
- * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3115 |
- * |
|
3116 |
- * @return bool |
|
3117 |
- */ |
|
3118 |
- public function notEqualTo($date): bool; |
|
3119 |
- |
|
3120 |
- /** |
|
3121 |
- * Get a Carbon instance for the current date and time. |
|
3122 |
- * |
|
3123 |
- * @param \DateTimeZone|string|null $tz |
|
3124 |
- * |
|
3125 |
- * @return static |
|
3126 |
- */ |
|
3127 |
- public static function now($tz = null); |
|
3128 |
- |
|
3129 |
- /** |
|
3130 |
- * Returns a present instance in the same timezone. |
|
3131 |
- * |
|
3132 |
- * @return static |
|
3133 |
- */ |
|
3134 |
- public function nowWithSameTz(); |
|
3135 |
- |
|
3136 |
- /** |
|
3137 |
- * Modify to the given occurrence of a given day of the week |
|
3138 |
- * in the current month. If the calculated occurrence is outside the scope |
|
3139 |
- * of the current month, then return false and no modifications are made. |
|
3140 |
- * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3141 |
- * |
|
3142 |
- * @param int $nth |
|
3143 |
- * @param int $dayOfWeek |
|
3144 |
- * |
|
3145 |
- * @return mixed |
|
3146 |
- */ |
|
3147 |
- public function nthOfMonth($nth, $dayOfWeek); |
|
3148 |
- |
|
3149 |
- /** |
|
3150 |
- * Modify to the given occurrence of a given day of the week |
|
3151 |
- * in the current quarter. If the calculated occurrence is outside the scope |
|
3152 |
- * of the current quarter, then return false and no modifications are made. |
|
3153 |
- * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3154 |
- * |
|
3155 |
- * @param int $nth |
|
3156 |
- * @param int $dayOfWeek |
|
3157 |
- * |
|
3158 |
- * @return mixed |
|
3159 |
- */ |
|
3160 |
- public function nthOfQuarter($nth, $dayOfWeek); |
|
3161 |
- |
|
3162 |
- /** |
|
3163 |
- * Modify to the given occurrence of a given day of the week |
|
3164 |
- * in the current year. If the calculated occurrence is outside the scope |
|
3165 |
- * of the current year, then return false and no modifications are made. |
|
3166 |
- * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3167 |
- * |
|
3168 |
- * @param int $nth |
|
3169 |
- * @param int $dayOfWeek |
|
3170 |
- * |
|
3171 |
- * @return mixed |
|
3172 |
- */ |
|
3173 |
- public function nthOfYear($nth, $dayOfWeek); |
|
3174 |
- |
|
3175 |
- /** |
|
3176 |
- * Return a property with its ordinal. |
|
3177 |
- * |
|
3178 |
- * @param string $key |
|
3179 |
- * @param string|null $period |
|
3180 |
- * |
|
3181 |
- * @return string |
|
3182 |
- */ |
|
3183 |
- public function ordinal(string $key, string $period = null): string; |
|
3184 |
- |
|
3185 |
- /** |
|
3186 |
- * Create a carbon instance from a string. |
|
3187 |
- * |
|
3188 |
- * This is an alias for the constructor that allows better fluent syntax |
|
3189 |
- * as it allows you to do Carbon::parse('Monday next week')->fn() rather |
|
3190 |
- * than (new Carbon('Monday next week'))->fn(). |
|
3191 |
- * |
|
3192 |
- * @param string|null $time |
|
3193 |
- * @param \DateTimeZone|string|null $tz |
|
3194 |
- * |
|
3195 |
- * @return static |
|
3196 |
- */ |
|
3197 |
- public static function parse($time = null, $tz = null); |
|
3198 |
- |
|
3199 |
- /** |
|
3200 |
- * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). |
|
3201 |
- * |
|
3202 |
- * @param string $time |
|
3203 |
- * @param string $locale |
|
3204 |
- * @param \DateTimeZone|string|null $tz |
|
3205 |
- * |
|
3206 |
- * @return static |
|
3207 |
- */ |
|
3208 |
- public static function parseFromLocale($time, $locale, $tz = null); |
|
3209 |
- |
|
3210 |
- /** |
|
3211 |
- * Returns standardized plural of a given singular/plural unit name (in English). |
|
3212 |
- * |
|
3213 |
- * @param string $unit |
|
3214 |
- * |
|
3215 |
- * @return string |
|
3216 |
- */ |
|
3217 |
- public static function pluralUnit(string $unit): string; |
|
3218 |
- |
|
3219 |
- /** |
|
3220 |
- * Modify to the previous occurrence of a given modifier such as a day of |
|
3221 |
- * the week. If no dayOfWeek is provided, modify to the previous occurrence |
|
3222 |
- * of the current day of the week. Use the supplied constants |
|
3223 |
- * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3224 |
- * |
|
3225 |
- * @param string|int|null $modifier |
|
3226 |
- * |
|
3227 |
- * @return static |
|
3228 |
- */ |
|
3229 |
- public function previous($modifier = null); |
|
3230 |
- |
|
3231 |
- /** |
|
3232 |
- * Go backward to the previous weekday. |
|
3233 |
- * |
|
3234 |
- * @return static |
|
3235 |
- */ |
|
3236 |
- public function previousWeekday(); |
|
3237 |
- |
|
3238 |
- /** |
|
3239 |
- * Go backward to the previous weekend day. |
|
3240 |
- * |
|
3241 |
- * @return static |
|
3242 |
- */ |
|
3243 |
- public function previousWeekendDay(); |
|
3244 |
- |
|
3245 |
- /** |
|
3246 |
- * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). |
|
3247 |
- * |
|
3248 |
- * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date |
|
3249 |
- * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit |
|
3250 |
- * @param string|null $unit if specified, $interval must be an integer |
|
3251 |
- * |
|
3252 |
- * @return CarbonPeriod |
|
3253 |
- */ |
|
3254 |
- public function range($end = null, $interval = null, $unit = null); |
|
3255 |
- |
|
3256 |
- /** |
|
3257 |
- * Create a Carbon instance from a specific format. |
|
3258 |
- * |
|
3259 |
- * @param string $format Datetime format |
|
3260 |
- * @param string $time |
|
3261 |
- * @param \DateTimeZone|string|false|null $tz |
|
3262 |
- * |
|
3263 |
- * @throws InvalidArgumentException |
|
3264 |
- * |
|
3265 |
- * @return static|false |
|
3266 |
- */ |
|
3267 |
- public static function rawCreateFromFormat($format, $time, $tz = null); |
|
3268 |
- |
|
3269 |
- /** |
|
3270 |
- * @see https://php.net/manual/en/datetime.format.php |
|
3271 |
- * |
|
3272 |
- * @param string $format |
|
3273 |
- * |
|
3274 |
- * @return string |
|
3275 |
- */ |
|
3276 |
- public function rawFormat($format); |
|
3277 |
- |
|
3278 |
- /** |
|
3279 |
- * Create a carbon instance from a string. |
|
3280 |
- * |
|
3281 |
- * This is an alias for the constructor that allows better fluent syntax |
|
3282 |
- * as it allows you to do Carbon::parse('Monday next week')->fn() rather |
|
3283 |
- * than (new Carbon('Monday next week'))->fn(). |
|
3284 |
- * |
|
3285 |
- * @param string|null $time |
|
3286 |
- * @param \DateTimeZone|string|null $tz |
|
3287 |
- * |
|
3288 |
- * @return static |
|
3289 |
- */ |
|
3290 |
- public static function rawParse($time = null, $tz = null); |
|
3291 |
- |
|
3292 |
- /** |
|
3293 |
- * Remove all macros and generic macros. |
|
3294 |
- */ |
|
3295 |
- public static function resetMacros(); |
|
3296 |
- |
|
3297 |
- /** |
|
3298 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3299 |
- * You should rather use the ->settings() method. |
|
3300 |
- * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants |
|
3301 |
- * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
3302 |
- * @see settings |
|
3303 |
- * |
|
3304 |
- * Reset the month overflow behavior. |
|
3305 |
- * |
|
3306 |
- * @return void |
|
3307 |
- */ |
|
3308 |
- public static function resetMonthsOverflow(); |
|
3309 |
- |
|
3310 |
- /** |
|
3311 |
- * Reset the format used to the default when type juggling a Carbon instance to a string |
|
3312 |
- * |
|
3313 |
- * @return void |
|
3314 |
- */ |
|
3315 |
- public static function resetToStringFormat(); |
|
3316 |
- |
|
3317 |
- /** |
|
3318 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3319 |
- * You should rather use the ->settings() method. |
|
3320 |
- * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants |
|
3321 |
- * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
3322 |
- * @see settings |
|
3323 |
- * |
|
3324 |
- * Reset the month overflow behavior. |
|
3325 |
- * |
|
3326 |
- * @return void |
|
3327 |
- */ |
|
3328 |
- public static function resetYearsOverflow(); |
|
3329 |
- |
|
3330 |
- /** |
|
3331 |
- * Round the current instance second with given precision if specified. |
|
3332 |
- * |
|
3333 |
- * @param float|int $precision |
|
3334 |
- * @param string $function |
|
3335 |
- * |
|
3336 |
- * @return CarbonInterface |
|
3337 |
- */ |
|
3338 |
- public function round($precision = 1, $function = 'round'); |
|
3339 |
- |
|
3340 |
- /** |
|
3341 |
- * Round the current instance at the given unit with given precision if specified and the given function. |
|
3342 |
- * |
|
3343 |
- * @param string $unit |
|
3344 |
- * @param float|int $precision |
|
3345 |
- * @param string $function |
|
3346 |
- * |
|
3347 |
- * @return CarbonInterface |
|
3348 |
- */ |
|
3349 |
- public function roundUnit($unit, $precision = 1, $function = 'round'); |
|
3350 |
- |
|
3351 |
- /** |
|
3352 |
- * Round the current instance week. |
|
3353 |
- * |
|
3354 |
- * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
3355 |
- * |
|
3356 |
- * @return CarbonInterface |
|
3357 |
- */ |
|
3358 |
- public function roundWeek($weekStartsAt = null); |
|
3359 |
- |
|
3360 |
- /** |
|
3361 |
- * The number of seconds since midnight. |
|
3362 |
- * |
|
3363 |
- * @return int |
|
3364 |
- */ |
|
3365 |
- public function secondsSinceMidnight(); |
|
3366 |
- |
|
3367 |
- /** |
|
3368 |
- * The number of seconds until 23:59:59. |
|
3369 |
- * |
|
3370 |
- * @return int |
|
3371 |
- */ |
|
3372 |
- public function secondsUntilEndOfDay(); |
|
3373 |
- |
|
3374 |
- /** |
|
3375 |
- * Return a serialized string of the instance. |
|
3376 |
- * |
|
3377 |
- * @return string |
|
3378 |
- */ |
|
3379 |
- public function serialize(); |
|
3380 |
- |
|
3381 |
- /** |
|
3382 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3383 |
- * You should rather transform Carbon object before the serialization. |
|
3384 |
- * |
|
3385 |
- * JSON serialize all Carbon instances using the given callback. |
|
3386 |
- * |
|
3387 |
- * @param callable $callback |
|
3388 |
- * |
|
3389 |
- * @return void |
|
3390 |
- */ |
|
3391 |
- public static function serializeUsing($callback); |
|
3392 |
- |
|
3393 |
- /** |
|
3394 |
- * Set a part of the Carbon object |
|
3395 |
- * |
|
3396 |
- * @param string|array $name |
|
3397 |
- * @param string|int|\DateTimeZone $value |
|
3398 |
- * |
|
3399 |
- * @throws InvalidArgumentException|ReflectionException |
|
3400 |
- * |
|
3401 |
- * @return $this |
|
3402 |
- */ |
|
3403 |
- public function set($name, $value = null); |
|
3404 |
- |
|
3405 |
- public function setDate($year, $month, $day); |
|
3406 |
- |
|
3407 |
- /** |
|
3408 |
- * Set the year, month, and date for this instance to that of the passed instance. |
|
3409 |
- * |
|
3410 |
- * @param \Carbon\Carbon|\DateTimeInterface $date now if null |
|
3411 |
- * |
|
3412 |
- * @return static |
|
3413 |
- */ |
|
3414 |
- public function setDateFrom($date = null); |
|
3415 |
- |
|
3416 |
- /** |
|
3417 |
- * Set the date and time all together. |
|
3418 |
- * |
|
3419 |
- * @param int $year |
|
3420 |
- * @param int $month |
|
3421 |
- * @param int $day |
|
3422 |
- * @param int $hour |
|
3423 |
- * @param int $minute |
|
3424 |
- * @param int $second |
|
3425 |
- * @param int $microseconds |
|
3426 |
- * |
|
3427 |
- * @return static |
|
3428 |
- */ |
|
3429 |
- public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0); |
|
3430 |
- |
|
3431 |
- /** |
|
3432 |
- * Set the date and time for this instance to that of the passed instance. |
|
3433 |
- * |
|
3434 |
- * @param \Carbon\Carbon|\DateTimeInterface $date |
|
3435 |
- * |
|
3436 |
- * @return static |
|
3437 |
- */ |
|
3438 |
- public function setDateTimeFrom($date = null); |
|
3439 |
- |
|
3440 |
- /** |
|
3441 |
- * Set the fallback locale. |
|
3442 |
- * |
|
3443 |
- * @see https://symfony.com/doc/current/components/translation.html#fallback-locales |
|
3444 |
- * |
|
3445 |
- * @param string $locale |
|
3446 |
- */ |
|
3447 |
- public static function setFallbackLocale($locale); |
|
3448 |
- |
|
3449 |
- /** |
|
3450 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3451 |
- * You should rather use the ->settings() method. |
|
3452 |
- * @see settings |
|
3453 |
- * |
|
3454 |
- * @param int $humanDiffOptions |
|
3455 |
- */ |
|
3456 |
- public static function setHumanDiffOptions($humanDiffOptions); |
|
3457 |
- |
|
3458 |
- /** |
|
3459 |
- * call \DateTime::setISODate if mutable or \DateTimeImmutable::setISODate else. |
|
3460 |
- * |
|
3461 |
- * @see https://php.net/manual/en/datetime.setisodate.php |
|
3462 |
- */ |
|
3463 |
- public function setISODate($year, $week, $day = 1); |
|
3464 |
- |
|
3465 |
- /** |
|
3466 |
- * Set the translator for the current instance. |
|
3467 |
- * |
|
3468 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
3469 |
- * |
|
3470 |
- * @return $this |
|
3471 |
- */ |
|
3472 |
- public function setLocalTranslator(\Symfony\Component\Translation\TranslatorInterface $translator); |
|
3473 |
- |
|
3474 |
- /** |
|
3475 |
- * Set the current translator locale and indicate if the source locale file exists. |
|
3476 |
- * Pass 'auto' as locale to use closest language from the current LC_TIME locale. |
|
3477 |
- * |
|
3478 |
- * @param string $locale locale ex. en |
|
3479 |
- * |
|
3480 |
- * @return bool |
|
3481 |
- */ |
|
3482 |
- public static function setLocale($locale); |
|
3483 |
- |
|
3484 |
- /** |
|
3485 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3486 |
- * You should rather consider mid-day is always 12pm, then if you need to test if it's an other |
|
3487 |
- * hour, test it explicitly: |
|
3488 |
- * $date->format('G') == 13 |
|
3489 |
- * or to set explicitly to a given hour: |
|
3490 |
- * $date->setTime(13, 0, 0, 0) |
|
3491 |
- * |
|
3492 |
- * Set midday/noon hour |
|
3493 |
- * |
|
3494 |
- * @param int $hour midday hour |
|
3495 |
- * |
|
3496 |
- * @return void |
|
3497 |
- */ |
|
3498 |
- public static function setMidDayAt($hour); |
|
3499 |
- |
|
3500 |
- /** |
|
3501 |
- * Set a Carbon instance (real or mock) to be returned when a "now" |
|
3502 |
- * instance is created. The provided instance will be returned |
|
3503 |
- * specifically under the following conditions: |
|
3504 |
- * - A call to the static now() method, ex. Carbon::now() |
|
3505 |
- * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) |
|
3506 |
- * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') |
|
3507 |
- * - When a string containing the desired time is passed to Carbon::parse(). |
|
3508 |
- * |
|
3509 |
- * Note the timezone parameter was left out of the examples above and |
|
3510 |
- * has no affect as the mock value will be returned regardless of its value. |
|
3511 |
- * |
|
3512 |
- * To clear the test instance call this method using the default |
|
3513 |
- * parameter of null. |
|
3514 |
- * |
|
3515 |
- * /!\ Use this method for unit tests only. |
|
3516 |
- * |
|
3517 |
- * @param static|string|null $testNow real or mock Carbon instance |
|
3518 |
- */ |
|
3519 |
- public static function setTestNow($testNow = null); |
|
3520 |
- |
|
3521 |
- /** |
|
3522 |
- * call \DateTime::setTime if mutable or \DateTimeImmutable::setTime else. |
|
3523 |
- * |
|
3524 |
- * @see https://php.net/manual/en/datetime.settime.php |
|
3525 |
- */ |
|
3526 |
- public function setTime($hour, $minute, $second = 0, $microseconds = 0); |
|
3527 |
- |
|
3528 |
- /** |
|
3529 |
- * Set the hour, minute, second and microseconds for this instance to that of the passed instance. |
|
3530 |
- * |
|
3531 |
- * @param \Carbon\Carbon|\DateTimeInterface $date now if null |
|
3532 |
- * |
|
3533 |
- * @return static |
|
3534 |
- */ |
|
3535 |
- public function setTimeFrom($date = null); |
|
3536 |
- |
|
3537 |
- /** |
|
3538 |
- * Set the time by time string. |
|
3539 |
- * |
|
3540 |
- * @param string $time |
|
3541 |
- * |
|
3542 |
- * @return static |
|
3543 |
- */ |
|
3544 |
- public function setTimeFromTimeString($time); |
|
3545 |
- |
|
3546 |
- /** |
|
3547 |
- * call \DateTime::setTimestamp if mutable or \DateTimeImmutable::setTimestamp else. |
|
3548 |
- * |
|
3549 |
- * @see https://php.net/manual/en/datetime.settimestamp.php |
|
3550 |
- */ |
|
3551 |
- public function setTimestamp($unixtimestamp); |
|
3552 |
- |
|
3553 |
- /** |
|
3554 |
- * Set the instance's timezone from a string or object. |
|
3555 |
- * |
|
3556 |
- * @param \DateTimeZone|string $value |
|
3557 |
- * |
|
3558 |
- * @return static |
|
3559 |
- */ |
|
3560 |
- public function setTimezone($value); |
|
3561 |
- |
|
3562 |
- /** |
|
3563 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3564 |
- * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and |
|
3565 |
- * use other method or custom format passed to format() method if you need to dump an other string |
|
3566 |
- * format. |
|
3567 |
- * |
|
3568 |
- * Set the default format used when type juggling a Carbon instance to a string |
|
3569 |
- * |
|
3570 |
- * @param string|Closure|null $format |
|
3571 |
- * |
|
3572 |
- * @return void |
|
3573 |
- */ |
|
3574 |
- public static function setToStringFormat($format); |
|
3575 |
- |
|
3576 |
- /** |
|
3577 |
- * Set the default translator instance to use. |
|
3578 |
- * |
|
3579 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
3580 |
- * |
|
3581 |
- * @return void |
|
3582 |
- */ |
|
3583 |
- public static function setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator); |
|
3584 |
- |
|
3585 |
- /** |
|
3586 |
- * Set specified unit to new given value. |
|
3587 |
- * |
|
3588 |
- * @param string $unit year, month, day, hour, minute, second or microsecond |
|
3589 |
- * @param int $value new value for given unit |
|
3590 |
- * |
|
3591 |
- * @return static |
|
3592 |
- */ |
|
3593 |
- public function setUnit($unit, $value = null); |
|
3594 |
- |
|
3595 |
- /** |
|
3596 |
- * Set any unit to a new value without overflowing current other unit given. |
|
3597 |
- * |
|
3598 |
- * @param string $valueUnit unit name to modify |
|
3599 |
- * @param int $value new value for the input unit |
|
3600 |
- * @param string $overflowUnit unit name to not overflow |
|
3601 |
- * |
|
3602 |
- * @return static |
|
3603 |
- */ |
|
3604 |
- public function setUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
3605 |
- |
|
3606 |
- /** |
|
3607 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3608 |
- * You should rather use UTF-8 language packages on every machine. |
|
3609 |
- * |
|
3610 |
- * Set if UTF8 will be used for localized date/time. |
|
3611 |
- * |
|
3612 |
- * @param bool $utf8 |
|
3613 |
- */ |
|
3614 |
- public static function setUtf8($utf8); |
|
3615 |
- |
|
3616 |
- /** |
|
3617 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3618 |
- * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek |
|
3619 |
- * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the |
|
3620 |
- * start of week according to current locale selected and implicitly the end of week. |
|
3621 |
- * |
|
3622 |
- * Set the last day of week |
|
3623 |
- * |
|
3624 |
- * @param int $day |
|
3625 |
- * |
|
3626 |
- * @return void |
|
3627 |
- */ |
|
3628 |
- public static function setWeekEndsAt($day); |
|
3629 |
- |
|
3630 |
- /** |
|
3631 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3632 |
- * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the |
|
3633 |
- * 'first_day_of_week' locale setting to change the start of week according to current locale |
|
3634 |
- * selected and implicitly the end of week. |
|
3635 |
- * |
|
3636 |
- * Set the first day of week |
|
3637 |
- * |
|
3638 |
- * @param int $day week start day |
|
3639 |
- * |
|
3640 |
- * @return void |
|
3641 |
- */ |
|
3642 |
- public static function setWeekStartsAt($day); |
|
3643 |
- |
|
3644 |
- /** |
|
3645 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3646 |
- * You should rather consider week-end is always saturday and sunday, and if you have some custom |
|
3647 |
- * week-end days to handle, give to those days an other name and create a macro for them: |
|
3648 |
- * |
|
3649 |
- * ``` |
|
3650 |
- * Carbon::macro('isDayOff', function ($date) { |
|
3651 |
- * return $date->isSunday() || $date->isMonday(); |
|
3652 |
- * }); |
|
3653 |
- * Carbon::macro('isNotDayOff', function ($date) { |
|
3654 |
- * return !$date->isDayOff(); |
|
3655 |
- * }); |
|
3656 |
- * if ($someDate->isDayOff()) ... |
|
3657 |
- * if ($someDate->isNotDayOff()) ... |
|
3658 |
- * // Add 5 not-off days |
|
3659 |
- * $count = 5; |
|
3660 |
- * while ($someDate->isDayOff() || ($count-- > 0)) { |
|
3661 |
- * $someDate->addDay(); |
|
3662 |
- * } |
|
3663 |
- * ``` |
|
3664 |
- * |
|
3665 |
- * Set weekend days |
|
3666 |
- * |
|
3667 |
- * @param array $days |
|
3668 |
- * |
|
3669 |
- * @return void |
|
3670 |
- */ |
|
3671 |
- public static function setWeekendDays($days); |
|
3672 |
- |
|
3673 |
- /** |
|
3674 |
- * Set specific options. |
|
3675 |
- * - strictMode: true|false|null |
|
3676 |
- * - monthOverflow: true|false|null |
|
3677 |
- * - yearOverflow: true|false|null |
|
3678 |
- * - humanDiffOptions: int|null |
|
3679 |
- * - toStringFormat: string|Closure|null |
|
3680 |
- * - toJsonFormat: string|Closure|null |
|
3681 |
- * - locale: string|null |
|
3682 |
- * - timezone: \DateTimeZone|string|int|null |
|
3683 |
- * - macros: array|null |
|
3684 |
- * - genericMacros: array|null |
|
3685 |
- * |
|
3686 |
- * @param array $settings |
|
3687 |
- * |
|
3688 |
- * @return $this|static |
|
3689 |
- */ |
|
3690 |
- public function settings(array $settings); |
|
3691 |
- |
|
3692 |
- /** |
|
3693 |
- * Set the instance's timezone from a string or object and add/subtract the offset difference. |
|
3694 |
- * |
|
3695 |
- * @param \DateTimeZone|string $value |
|
3696 |
- * |
|
3697 |
- * @return static |
|
3698 |
- */ |
|
3699 |
- public function shiftTimezone($value); |
|
3700 |
- |
|
3701 |
- /** |
|
3702 |
- * Get the month overflow global behavior (can be overridden in specific instances). |
|
3703 |
- * |
|
3704 |
- * @return bool |
|
3705 |
- */ |
|
3706 |
- public static function shouldOverflowMonths(); |
|
3707 |
- |
|
3708 |
- /** |
|
3709 |
- * Get the month overflow global behavior (can be overridden in specific instances). |
|
3710 |
- * |
|
3711 |
- * @return bool |
|
3712 |
- */ |
|
3713 |
- public static function shouldOverflowYears(); |
|
3714 |
- |
|
3715 |
- /** |
|
3716 |
- * @alias diffForHumans |
|
3717 |
- * |
|
3718 |
- * Get the difference in a human readable format in the current locale from current instance to an other |
|
3719 |
- * instance given (or now if null given). |
|
3720 |
- */ |
|
3721 |
- public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
3722 |
- |
|
3723 |
- /** |
|
3724 |
- * Returns standardized singular of a given singular/plural unit name (in English). |
|
3725 |
- * |
|
3726 |
- * @param string $unit |
|
3727 |
- * |
|
3728 |
- * @return string |
|
3729 |
- */ |
|
3730 |
- public static function singularUnit(string $unit): string; |
|
3731 |
- |
|
3732 |
- /** |
|
3733 |
- * Modify to start of current given unit. |
|
3734 |
- * |
|
3735 |
- * @example |
|
3736 |
- * ``` |
|
3737 |
- * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
3738 |
- * ->startOf('month') |
|
3739 |
- * ->endOf('week', Carbon::FRIDAY); |
|
3740 |
- * ``` |
|
3741 |
- * |
|
3742 |
- * @param string $unit |
|
3743 |
- * @param array<int, mixed> $params |
|
3744 |
- * |
|
3745 |
- * @return static |
|
3746 |
- */ |
|
3747 |
- public function startOf($unit, ...$params); |
|
3748 |
- |
|
3749 |
- /** |
|
3750 |
- * Resets the date to the first day of the century and the time to 00:00:00 |
|
3751 |
- * |
|
3752 |
- * @example |
|
3753 |
- * ``` |
|
3754 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury(); |
|
3755 |
- * ``` |
|
3756 |
- * |
|
3757 |
- * @return static |
|
3758 |
- */ |
|
3759 |
- public function startOfCentury(); |
|
3760 |
- |
|
3761 |
- /** |
|
3762 |
- * Resets the time to 00:00:00 start of day |
|
3763 |
- * |
|
3764 |
- * @example |
|
3765 |
- * ``` |
|
3766 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfDay(); |
|
3767 |
- * ``` |
|
3768 |
- * |
|
3769 |
- * @return static |
|
3770 |
- */ |
|
3771 |
- public function startOfDay(); |
|
3772 |
- |
|
3773 |
- /** |
|
3774 |
- * Resets the date to the first day of the decade and the time to 00:00:00 |
|
3775 |
- * |
|
3776 |
- * @example |
|
3777 |
- * ``` |
|
3778 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade(); |
|
3779 |
- * ``` |
|
3780 |
- * |
|
3781 |
- * @return static |
|
3782 |
- */ |
|
3783 |
- public function startOfDecade(); |
|
3784 |
- |
|
3785 |
- /** |
|
3786 |
- * Modify to start of current hour, minutes and seconds become 0 |
|
3787 |
- * |
|
3788 |
- * @example |
|
3789 |
- * ``` |
|
3790 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfHour(); |
|
3791 |
- * ``` |
|
3792 |
- * |
|
3793 |
- * @return static |
|
3794 |
- */ |
|
3795 |
- public function startOfHour(); |
|
3796 |
- |
|
3797 |
- /** |
|
3798 |
- * Resets the date to the first day of the century and the time to 00:00:00 |
|
3799 |
- * |
|
3800 |
- * @example |
|
3801 |
- * ``` |
|
3802 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium(); |
|
3803 |
- * ``` |
|
3804 |
- * |
|
3805 |
- * @return static |
|
3806 |
- */ |
|
3807 |
- public function startOfMillennium(); |
|
3808 |
- |
|
3809 |
- /** |
|
3810 |
- * Modify to start of current minute, seconds become 0 |
|
3811 |
- * |
|
3812 |
- * @example |
|
3813 |
- * ``` |
|
3814 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute(); |
|
3815 |
- * ``` |
|
3816 |
- * |
|
3817 |
- * @return static |
|
3818 |
- */ |
|
3819 |
- public function startOfMinute(); |
|
3820 |
- |
|
3821 |
- /** |
|
3822 |
- * Resets the date to the first day of the month and the time to 00:00:00 |
|
3823 |
- * |
|
3824 |
- * @example |
|
3825 |
- * ``` |
|
3826 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth(); |
|
3827 |
- * ``` |
|
3828 |
- * |
|
3829 |
- * @return static |
|
3830 |
- */ |
|
3831 |
- public function startOfMonth(); |
|
3832 |
- |
|
3833 |
- /** |
|
3834 |
- * Resets the date to the first day of the quarter and the time to 00:00:00 |
|
3835 |
- * |
|
3836 |
- * @example |
|
3837 |
- * ``` |
|
3838 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter(); |
|
3839 |
- * ``` |
|
3840 |
- * |
|
3841 |
- * @return static |
|
3842 |
- */ |
|
3843 |
- public function startOfQuarter(); |
|
3844 |
- |
|
3845 |
- /** |
|
3846 |
- * Modify to start of current second, microseconds become 0 |
|
3847 |
- * |
|
3848 |
- * @example |
|
3849 |
- * ``` |
|
3850 |
- * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
3851 |
- * ->startOfSecond() |
|
3852 |
- * ->format('H:i:s.u'); |
|
3853 |
- * ``` |
|
3854 |
- * |
|
3855 |
- * @return static |
|
3856 |
- */ |
|
3857 |
- public function startOfSecond(); |
|
3858 |
- |
|
3859 |
- /** |
|
3860 |
- * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 |
|
3861 |
- * |
|
3862 |
- * @example |
|
3863 |
- * ``` |
|
3864 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n"; |
|
3865 |
- * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n"; |
|
3866 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n"; |
|
3867 |
- * ``` |
|
3868 |
- * |
|
3869 |
- * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
3870 |
- * |
|
3871 |
- * @return static |
|
3872 |
- */ |
|
3873 |
- public function startOfWeek($weekStartsAt = null); |
|
3874 |
- |
|
3875 |
- /** |
|
3876 |
- * Resets the date to the first day of the year and the time to 00:00:00 |
|
3877 |
- * |
|
3878 |
- * @example |
|
3879 |
- * ``` |
|
3880 |
- * echo Carbon::parse('2018-07-25 12:45:16')->startOfYear(); |
|
3881 |
- * ``` |
|
3882 |
- * |
|
3883 |
- * @return static |
|
3884 |
- */ |
|
3885 |
- public function startOfYear(); |
|
3886 |
- |
|
3887 |
- /** |
|
3888 |
- * Subtract given units or interval to the current instance. |
|
3889 |
- * |
|
3890 |
- * @example $date->sub('hour', 3) |
|
3891 |
- * @example $date->sub(15, 'days') |
|
3892 |
- * @example $date->sub(CarbonInterval::days(4)) |
|
3893 |
- * |
|
3894 |
- * @param string|DateInterval $unit |
|
3895 |
- * @param int $value |
|
3896 |
- * @param bool|null $overflow |
|
3897 |
- * |
|
3898 |
- * @return CarbonInterface |
|
3899 |
- */ |
|
3900 |
- public function sub($unit, $value = 1, $overflow = null); |
|
3901 |
- |
|
3902 |
- public function subRealUnit($unit, $value = 1); |
|
3903 |
- |
|
3904 |
- /** |
|
3905 |
- * Subtract given units to the current instance. |
|
3906 |
- * |
|
3907 |
- * @param string $unit |
|
3908 |
- * @param int $value |
|
3909 |
- * @param bool|null $overflow |
|
3910 |
- * |
|
3911 |
- * @return CarbonInterface |
|
3912 |
- */ |
|
3913 |
- public function subUnit($unit, $value = 1, $overflow = null); |
|
3914 |
- |
|
3915 |
- /** |
|
3916 |
- * Subtract any unit to a new value without overflowing current other unit given. |
|
3917 |
- * |
|
3918 |
- * @param string $valueUnit unit name to modify |
|
3919 |
- * @param int $value amount to subtract to the input unit |
|
3920 |
- * @param string $overflowUnit unit name to not overflow |
|
3921 |
- * |
|
3922 |
- * @return static |
|
3923 |
- */ |
|
3924 |
- public function subUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
3925 |
- |
|
3926 |
- /** |
|
3927 |
- * Subtract given units or interval to the current instance. |
|
3928 |
- * |
|
3929 |
- * @see sub() |
|
3930 |
- * |
|
3931 |
- * @param string|DateInterval $unit |
|
3932 |
- * @param int $value |
|
3933 |
- * @param bool|null $overflow |
|
3934 |
- * |
|
3935 |
- * @return CarbonInterface |
|
3936 |
- */ |
|
3937 |
- public function subtract($unit, $value = 1, $overflow = null); |
|
3938 |
- |
|
3939 |
- /** |
|
3940 |
- * Get the difference in a human readable format in the current locale from current instance to an other |
|
3941 |
- * instance given (or now if null given). |
|
3942 |
- * |
|
3943 |
- * @return string |
|
3944 |
- */ |
|
3945 |
- public function timespan($other = null, $timezone = null); |
|
3946 |
- |
|
3947 |
- /** |
|
3948 |
- * Set the instance's timestamp. |
|
3949 |
- * |
|
3950 |
- * @param int $value |
|
3951 |
- * |
|
3952 |
- * @return static |
|
3953 |
- */ |
|
3954 |
- public function timestamp($value); |
|
3955 |
- |
|
3956 |
- /** |
|
3957 |
- * @alias setTimezone |
|
3958 |
- * |
|
3959 |
- * @param \DateTimeZone|string $value |
|
3960 |
- * |
|
3961 |
- * @return static |
|
3962 |
- */ |
|
3963 |
- public function timezone($value); |
|
3964 |
- |
|
3965 |
- /** |
|
3966 |
- * Get the difference in a human readable format in the current locale from an other |
|
3967 |
- * instance given (or now if null given) to current instance. |
|
3968 |
- * |
|
3969 |
- * When comparing a value in the past to default now: |
|
3970 |
- * 1 hour from now |
|
3971 |
- * 5 months from now |
|
3972 |
- * |
|
3973 |
- * When comparing a value in the future to default now: |
|
3974 |
- * 1 hour ago |
|
3975 |
- * 5 months ago |
|
3976 |
- * |
|
3977 |
- * When comparing a value in the past to another value: |
|
3978 |
- * 1 hour after |
|
3979 |
- * 5 months after |
|
3980 |
- * |
|
3981 |
- * When comparing a value in the future to another value: |
|
3982 |
- * 1 hour before |
|
3983 |
- * 5 months before |
|
3984 |
- * |
|
3985 |
- * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
3986 |
- * if null passed, now will be used as comparison reference; |
|
3987 |
- * if any other type, it will be converted to date and used as reference. |
|
3988 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
3989 |
- * - 'syntax' entry (see below) |
|
3990 |
- * - 'short' entry (see below) |
|
3991 |
- * - 'parts' entry (see below) |
|
3992 |
- * - 'options' entry (see below) |
|
3993 |
- * - 'join' entry determines how to join multiple parts of the string |
|
3994 |
- * ` - if $join is a string, it's used as a joiner glue |
|
3995 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
3996 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
3997 |
- * ` will be used instead of the glue for the last item |
|
3998 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
3999 |
- * ` - if $join is missing, a space will be used as glue |
|
4000 |
- * - 'other' entry (see above) |
|
4001 |
- * if int passed, it add modifiers: |
|
4002 |
- * Possible values: |
|
4003 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4004 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4005 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4006 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4007 |
- * @param bool $short displays short format of time units |
|
4008 |
- * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
4009 |
- * @param int $options human diff options |
|
4010 |
- * |
|
4011 |
- * @return string |
|
4012 |
- */ |
|
4013 |
- public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
4014 |
- |
|
4015 |
- /** |
|
4016 |
- * Get default array representation. |
|
4017 |
- * |
|
4018 |
- * @example |
|
4019 |
- * ``` |
|
4020 |
- * var_dump(Carbon::now()->toArray()); |
|
4021 |
- * ``` |
|
4022 |
- * |
|
4023 |
- * @return array |
|
4024 |
- */ |
|
4025 |
- public function toArray(); |
|
4026 |
- |
|
4027 |
- /** |
|
4028 |
- * Format the instance as ATOM |
|
4029 |
- * |
|
4030 |
- * @example |
|
4031 |
- * ``` |
|
4032 |
- * echo Carbon::now()->toAtomString(); |
|
4033 |
- * ``` |
|
4034 |
- * |
|
4035 |
- * @return string |
|
4036 |
- */ |
|
4037 |
- public function toAtomString(); |
|
4038 |
- |
|
4039 |
- /** |
|
4040 |
- * Format the instance as COOKIE |
|
4041 |
- * |
|
4042 |
- * @example |
|
4043 |
- * ``` |
|
4044 |
- * echo Carbon::now()->toCookieString(); |
|
4045 |
- * ``` |
|
4046 |
- * |
|
4047 |
- * @return string |
|
4048 |
- */ |
|
4049 |
- public function toCookieString(); |
|
4050 |
- |
|
4051 |
- /** |
|
4052 |
- * @alias toDateTime |
|
4053 |
- * |
|
4054 |
- * Return native DateTime PHP object matching the current instance. |
|
4055 |
- * |
|
4056 |
- * @example |
|
4057 |
- * ``` |
|
4058 |
- * var_dump(Carbon::now()->toDate()); |
|
4059 |
- * ``` |
|
4060 |
- * |
|
4061 |
- * @return DateTime |
|
4062 |
- */ |
|
4063 |
- public function toDate(); |
|
4064 |
- |
|
4065 |
- /** |
|
4066 |
- * Format the instance as date |
|
4067 |
- * |
|
4068 |
- * @example |
|
4069 |
- * ``` |
|
4070 |
- * echo Carbon::now()->toDateString(); |
|
4071 |
- * ``` |
|
4072 |
- * |
|
4073 |
- * @return string |
|
4074 |
- */ |
|
4075 |
- public function toDateString(); |
|
4076 |
- |
|
4077 |
- /** |
|
4078 |
- * Return native DateTime PHP object matching the current instance. |
|
4079 |
- * |
|
4080 |
- * @example |
|
4081 |
- * ``` |
|
4082 |
- * var_dump(Carbon::now()->toDateTime()); |
|
4083 |
- * ``` |
|
4084 |
- * |
|
4085 |
- * @return DateTime |
|
4086 |
- */ |
|
4087 |
- public function toDateTime(); |
|
4088 |
- |
|
4089 |
- /** |
|
4090 |
- * Format the instance as date and time T-separated with no timezone |
|
4091 |
- * |
|
4092 |
- * @example |
|
4093 |
- * ``` |
|
4094 |
- * echo Carbon::now()->toDateTimeLocalString(); |
|
4095 |
- * ``` |
|
4096 |
- * |
|
4097 |
- * @return string |
|
4098 |
- */ |
|
4099 |
- public function toDateTimeLocalString(); |
|
4100 |
- |
|
4101 |
- /** |
|
4102 |
- * Format the instance as date and time |
|
4103 |
- * |
|
4104 |
- * @example |
|
4105 |
- * ``` |
|
4106 |
- * echo Carbon::now()->toDateTimeString(); |
|
4107 |
- * ``` |
|
4108 |
- * |
|
4109 |
- * @return string |
|
4110 |
- */ |
|
4111 |
- public function toDateTimeString(); |
|
4112 |
- |
|
4113 |
- /** |
|
4114 |
- * Format the instance with day, date and time |
|
4115 |
- * |
|
4116 |
- * @example |
|
4117 |
- * ``` |
|
4118 |
- * echo Carbon::now()->toDayDateTimeString(); |
|
4119 |
- * ``` |
|
4120 |
- * |
|
4121 |
- * @return string |
|
4122 |
- */ |
|
4123 |
- public function toDayDateTimeString(); |
|
4124 |
- |
|
4125 |
- /** |
|
4126 |
- * Format the instance as a readable date |
|
4127 |
- * |
|
4128 |
- * @example |
|
4129 |
- * ``` |
|
4130 |
- * echo Carbon::now()->toFormattedDateString(); |
|
4131 |
- * ``` |
|
4132 |
- * |
|
4133 |
- * @return string |
|
4134 |
- */ |
|
4135 |
- public function toFormattedDateString(); |
|
4136 |
- |
|
4137 |
- /** |
|
4138 |
- * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: |
|
4139 |
- * 1977-04-22T01:00:00-05:00). |
|
4140 |
- * |
|
4141 |
- * @example |
|
4142 |
- * ``` |
|
4143 |
- * echo Carbon::now('America/Toronto')->toISOString() . "\n"; |
|
4144 |
- * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; |
|
4145 |
- * ``` |
|
4146 |
- * |
|
4147 |
- * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. |
|
4148 |
- * |
|
4149 |
- * @return null|string |
|
4150 |
- */ |
|
4151 |
- public function toISOString($keepOffset = false); |
|
4152 |
- |
|
4153 |
- /** |
|
4154 |
- * Return a immutable copy of the instance. |
|
4155 |
- * |
|
4156 |
- * @return CarbonImmutable |
|
4157 |
- */ |
|
4158 |
- public function toImmutable(); |
|
4159 |
- |
|
4160 |
- /** |
|
4161 |
- * Format the instance as ISO8601 |
|
4162 |
- * |
|
4163 |
- * @example |
|
4164 |
- * ``` |
|
4165 |
- * echo Carbon::now()->toIso8601String(); |
|
4166 |
- * ``` |
|
4167 |
- * |
|
4168 |
- * @return string |
|
4169 |
- */ |
|
4170 |
- public function toIso8601String(); |
|
4171 |
- |
|
4172 |
- /** |
|
4173 |
- * Convert the instance to UTC and return as Zulu ISO8601 |
|
4174 |
- * |
|
4175 |
- * @example |
|
4176 |
- * ``` |
|
4177 |
- * echo Carbon::now()->toIso8601ZuluString(); |
|
4178 |
- * ``` |
|
4179 |
- * |
|
4180 |
- * @return string |
|
4181 |
- */ |
|
4182 |
- public function toIso8601ZuluString(); |
|
4183 |
- |
|
4184 |
- /** |
|
4185 |
- * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. |
|
4186 |
- * |
|
4187 |
- * @example |
|
4188 |
- * ``` |
|
4189 |
- * echo Carbon::now('America/Toronto')->toJSON(); |
|
4190 |
- * ``` |
|
4191 |
- * |
|
4192 |
- * @return null|string |
|
4193 |
- */ |
|
4194 |
- public function toJSON(); |
|
4195 |
- |
|
4196 |
- /** |
|
4197 |
- * Return a mutable copy of the instance. |
|
4198 |
- * |
|
4199 |
- * @return Carbon |
|
4200 |
- */ |
|
4201 |
- public function toMutable(); |
|
4202 |
- |
|
4203 |
- /** |
|
4204 |
- * Get the difference in a human readable format in the current locale from an other |
|
4205 |
- * instance given to now |
|
4206 |
- * |
|
4207 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
4208 |
- * - 'syntax' entry (see below) |
|
4209 |
- * - 'short' entry (see below) |
|
4210 |
- * - 'parts' entry (see below) |
|
4211 |
- * - 'options' entry (see below) |
|
4212 |
- * - 'join' entry determines how to join multiple parts of the string |
|
4213 |
- * ` - if $join is a string, it's used as a joiner glue |
|
4214 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
4215 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
4216 |
- * ` will be used instead of the glue for the last item |
|
4217 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
4218 |
- * ` - if $join is missing, a space will be used as glue |
|
4219 |
- * if int passed, it add modifiers: |
|
4220 |
- * Possible values: |
|
4221 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4222 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4223 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4224 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4225 |
- * @param bool $short displays short format of time units |
|
4226 |
- * @param int $parts maximum number of parts to display (default value: 1: single part) |
|
4227 |
- * @param int $options human diff options |
|
4228 |
- * |
|
4229 |
- * @return string |
|
4230 |
- */ |
|
4231 |
- public function toNow($syntax = null, $short = false, $parts = 1, $options = null); |
|
4232 |
- |
|
4233 |
- /** |
|
4234 |
- * Get default object representation. |
|
4235 |
- * |
|
4236 |
- * @example |
|
4237 |
- * ``` |
|
4238 |
- * var_dump(Carbon::now()->toObject()); |
|
4239 |
- * ``` |
|
4240 |
- * |
|
4241 |
- * @return object |
|
4242 |
- */ |
|
4243 |
- public function toObject(); |
|
4244 |
- |
|
4245 |
- /** |
|
4246 |
- * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). |
|
4247 |
- * |
|
4248 |
- * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date |
|
4249 |
- * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit |
|
4250 |
- * @param string|null $unit if specified, $interval must be an integer |
|
4251 |
- * |
|
4252 |
- * @return CarbonPeriod |
|
4253 |
- */ |
|
4254 |
- public function toPeriod($end = null, $interval = null, $unit = null); |
|
4255 |
- |
|
4256 |
- /** |
|
4257 |
- * Format the instance as RFC1036 |
|
4258 |
- * |
|
4259 |
- * @example |
|
4260 |
- * ``` |
|
4261 |
- * echo Carbon::now()->toRfc1036String(); |
|
4262 |
- * ``` |
|
4263 |
- * |
|
4264 |
- * @return string |
|
4265 |
- */ |
|
4266 |
- public function toRfc1036String(); |
|
4267 |
- |
|
4268 |
- /** |
|
4269 |
- * Format the instance as RFC1123 |
|
4270 |
- * |
|
4271 |
- * @example |
|
4272 |
- * ``` |
|
4273 |
- * echo Carbon::now()->toRfc1123String(); |
|
4274 |
- * ``` |
|
4275 |
- * |
|
4276 |
- * @return string |
|
4277 |
- */ |
|
4278 |
- public function toRfc1123String(); |
|
4279 |
- |
|
4280 |
- /** |
|
4281 |
- * Format the instance as RFC2822 |
|
4282 |
- * |
|
4283 |
- * @example |
|
4284 |
- * ``` |
|
4285 |
- * echo Carbon::now()->toRfc2822String(); |
|
4286 |
- * ``` |
|
4287 |
- * |
|
4288 |
- * @return string |
|
4289 |
- */ |
|
4290 |
- public function toRfc2822String(); |
|
4291 |
- |
|
4292 |
- /** |
|
4293 |
- * Format the instance as RFC3339 |
|
4294 |
- * |
|
4295 |
- * @example |
|
4296 |
- * ``` |
|
4297 |
- * echo Carbon::now()->toRfc3339String(); |
|
4298 |
- * ``` |
|
4299 |
- * |
|
4300 |
- * @return string |
|
4301 |
- */ |
|
4302 |
- public function toRfc3339String(); |
|
4303 |
- |
|
4304 |
- /** |
|
4305 |
- * Format the instance as RFC7231 |
|
4306 |
- * |
|
4307 |
- * @example |
|
4308 |
- * ``` |
|
4309 |
- * echo Carbon::now()->toRfc7231String(); |
|
4310 |
- * ``` |
|
4311 |
- * |
|
4312 |
- * @return string |
|
4313 |
- */ |
|
4314 |
- public function toRfc7231String(); |
|
4315 |
- |
|
4316 |
- /** |
|
4317 |
- * Format the instance as RFC822 |
|
4318 |
- * |
|
4319 |
- * @example |
|
4320 |
- * ``` |
|
4321 |
- * echo Carbon::now()->toRfc822String(); |
|
4322 |
- * ``` |
|
4323 |
- * |
|
4324 |
- * @return string |
|
4325 |
- */ |
|
4326 |
- public function toRfc822String(); |
|
4327 |
- |
|
4328 |
- /** |
|
4329 |
- * Format the instance as RFC850 |
|
4330 |
- * |
|
4331 |
- * @example |
|
4332 |
- * ``` |
|
4333 |
- * echo Carbon::now()->toRfc850String(); |
|
4334 |
- * ``` |
|
4335 |
- * |
|
4336 |
- * @return string |
|
4337 |
- */ |
|
4338 |
- public function toRfc850String(); |
|
4339 |
- |
|
4340 |
- /** |
|
4341 |
- * Format the instance as RSS |
|
4342 |
- * |
|
4343 |
- * @example |
|
4344 |
- * ``` |
|
4345 |
- * echo Carbon::now()->toRssString(); |
|
4346 |
- * ``` |
|
4347 |
- * |
|
4348 |
- * @return string |
|
4349 |
- */ |
|
4350 |
- public function toRssString(); |
|
4351 |
- |
|
4352 |
- /** |
|
4353 |
- * Returns english human readable complete date string. |
|
4354 |
- * |
|
4355 |
- * @example |
|
4356 |
- * ``` |
|
4357 |
- * echo Carbon::now()->toString(); |
|
4358 |
- * ``` |
|
4359 |
- * |
|
4360 |
- * @return string |
|
4361 |
- */ |
|
4362 |
- public function toString(); |
|
4363 |
- |
|
4364 |
- /** |
|
4365 |
- * Format the instance as time |
|
4366 |
- * |
|
4367 |
- * @example |
|
4368 |
- * ``` |
|
4369 |
- * echo Carbon::now()->toTimeString(); |
|
4370 |
- * ``` |
|
4371 |
- * |
|
4372 |
- * @return string |
|
4373 |
- */ |
|
4374 |
- public function toTimeString(); |
|
4375 |
- |
|
4376 |
- /** |
|
4377 |
- * Format the instance as W3C |
|
4378 |
- * |
|
4379 |
- * @example |
|
4380 |
- * ``` |
|
4381 |
- * echo Carbon::now()->toW3cString(); |
|
4382 |
- * ``` |
|
4383 |
- * |
|
4384 |
- * @return string |
|
4385 |
- */ |
|
4386 |
- public function toW3cString(); |
|
4387 |
- |
|
4388 |
- /** |
|
4389 |
- * Create a Carbon instance for today. |
|
4390 |
- * |
|
4391 |
- * @param \DateTimeZone|string|null $tz |
|
4392 |
- * |
|
4393 |
- * @return static |
|
4394 |
- */ |
|
4395 |
- public static function today($tz = null); |
|
4396 |
- |
|
4397 |
- /** |
|
4398 |
- * Create a Carbon instance for tomorrow. |
|
4399 |
- * |
|
4400 |
- * @param \DateTimeZone|string|null $tz |
|
4401 |
- * |
|
4402 |
- * @return static |
|
4403 |
- */ |
|
4404 |
- public static function tomorrow($tz = null); |
|
4405 |
- |
|
4406 |
- /** |
|
4407 |
- * Translate using translation string or callback available. |
|
4408 |
- * |
|
4409 |
- * @param string $key |
|
4410 |
- * @param array $parameters |
|
4411 |
- * @param null $number |
|
4412 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
4413 |
- * |
|
4414 |
- * @return string |
|
4415 |
- */ |
|
4416 |
- public function translate(string $key, array $parameters = [], $number = null, \Symfony\Component\Translation\TranslatorInterface $translator = null): string; |
|
4417 |
- |
|
4418 |
- /** |
|
4419 |
- * Translate a time string from a locale to an other. |
|
4420 |
- * |
|
4421 |
- * @param string $timeString time string to translate |
|
4422 |
- * @param string|null $from input locale of the $timeString parameter (`Carbon::getLocale()` by default) |
|
4423 |
- * @param string|null $to output locale of the result returned (`"en"` by default) |
|
4424 |
- * @param int $mode specify what to translate with options: |
|
4425 |
- * - CarbonInterface::TRANSLATE_ALL (default) |
|
4426 |
- * - CarbonInterface::TRANSLATE_MONTHS |
|
4427 |
- * - CarbonInterface::TRANSLATE_DAYS |
|
4428 |
- * - CarbonInterface::TRANSLATE_UNITS |
|
4429 |
- * - CarbonInterface::TRANSLATE_MERIDIEM |
|
4430 |
- * You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS |
|
4431 |
- * |
|
4432 |
- * @return string |
|
4433 |
- */ |
|
4434 |
- public static function translateTimeString($timeString, $from = null, $to = null, $mode = 15); |
|
4435 |
- |
|
4436 |
- /** |
|
4437 |
- * Translate a time string from the current locale (`$date->locale()`) to an other. |
|
4438 |
- * |
|
4439 |
- * @param string $timeString time string to translate |
|
4440 |
- * @param string|null $to output locale of the result returned ("en" by default) |
|
4441 |
- * |
|
4442 |
- * @return string |
|
4443 |
- */ |
|
4444 |
- public function translateTimeStringTo($timeString, $to = null); |
|
4445 |
- |
|
4446 |
- /** |
|
4447 |
- * Translate using translation string or callback available. |
|
4448 |
- * |
|
4449 |
- * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
4450 |
- * @param string $key |
|
4451 |
- * @param array $parameters |
|
4452 |
- * @param null $number |
|
4453 |
- * |
|
4454 |
- * @return string |
|
4455 |
- */ |
|
4456 |
- public static function translateWith(\Symfony\Component\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null): string; |
|
4457 |
- |
|
4458 |
- /** |
|
4459 |
- * Format as ->format() do (using date replacements patterns from http://php.net/manual/fr/function.date.php) |
|
4460 |
- * but translate words whenever possible (months, day names, etc.) using the current locale. |
|
4461 |
- * |
|
4462 |
- * @param string $format |
|
4463 |
- * |
|
4464 |
- * @return string |
|
4465 |
- */ |
|
4466 |
- public function translatedFormat(string $format): string; |
|
4467 |
- |
|
4468 |
- /** |
|
4469 |
- * Set the timezone or returns the timezone name if no arguments passed. |
|
4470 |
- * |
|
4471 |
- * @param \DateTimeZone|string $value |
|
4472 |
- * |
|
4473 |
- * @return static|string |
|
4474 |
- */ |
|
4475 |
- public function tz($value = null); |
|
4476 |
- |
|
4477 |
- /** |
|
4478 |
- * @alias getTimestamp |
|
4479 |
- * |
|
4480 |
- * Returns the UNIX timestamp for the current date. |
|
4481 |
- * |
|
4482 |
- * @return int |
|
4483 |
- */ |
|
4484 |
- public function unix(); |
|
4485 |
- |
|
4486 |
- /** |
|
4487 |
- * @alias to |
|
4488 |
- * |
|
4489 |
- * Get the difference in a human readable format in the current locale from an other |
|
4490 |
- * instance given (or now if null given) to current instance. |
|
4491 |
- * |
|
4492 |
- * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
4493 |
- * if null passed, now will be used as comparison reference; |
|
4494 |
- * if any other type, it will be converted to date and used as reference. |
|
4495 |
- * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
4496 |
- * - 'syntax' entry (see below) |
|
4497 |
- * - 'short' entry (see below) |
|
4498 |
- * - 'parts' entry (see below) |
|
4499 |
- * - 'options' entry (see below) |
|
4500 |
- * - 'join' entry determines how to join multiple parts of the string |
|
4501 |
- * ` - if $join is a string, it's used as a joiner glue |
|
4502 |
- * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
4503 |
- * ` - if $join is an array, the first item will be the default glue, and the second item |
|
4504 |
- * ` will be used instead of the glue for the last item |
|
4505 |
- * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
4506 |
- * ` - if $join is missing, a space will be used as glue |
|
4507 |
- * - 'other' entry (see above) |
|
4508 |
- * if int passed, it add modifiers: |
|
4509 |
- * Possible values: |
|
4510 |
- * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4511 |
- * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4512 |
- * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4513 |
- * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4514 |
- * @param bool $short displays short format of time units |
|
4515 |
- * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
4516 |
- * @param int $options human diff options |
|
4517 |
- * |
|
4518 |
- * @return string |
|
4519 |
- */ |
|
4520 |
- public function until($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
4521 |
- |
|
4522 |
- /** |
|
4523 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4524 |
- * You should rather use the ->settings() method. |
|
4525 |
- * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants |
|
4526 |
- * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
4527 |
- * @see settings |
|
4528 |
- * |
|
4529 |
- * Indicates if months should be calculated with overflow. |
|
4530 |
- * |
|
4531 |
- * @param bool $monthsOverflow |
|
4532 |
- * |
|
4533 |
- * @return void |
|
4534 |
- */ |
|
4535 |
- public static function useMonthsOverflow($monthsOverflow = true); |
|
4536 |
- |
|
4537 |
- /** |
|
4538 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4539 |
- * You should rather use the ->settings() method. |
|
4540 |
- * @see settings |
|
4541 |
- * |
|
4542 |
- * Enable the strict mode (or disable with passing false). |
|
4543 |
- * |
|
4544 |
- * @param bool $strictModeEnabled |
|
4545 |
- */ |
|
4546 |
- public static function useStrictMode($strictModeEnabled = true); |
|
4547 |
- |
|
4548 |
- /** |
|
4549 |
- * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4550 |
- * You should rather use the ->settings() method. |
|
4551 |
- * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants |
|
4552 |
- * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
4553 |
- * @see settings |
|
4554 |
- * |
|
4555 |
- * Indicates if years should be calculated with overflow. |
|
4556 |
- * |
|
4557 |
- * @param bool $yearsOverflow |
|
4558 |
- * |
|
4559 |
- * @return void |
|
4560 |
- */ |
|
4561 |
- public static function useYearsOverflow($yearsOverflow = true); |
|
4562 |
- |
|
4563 |
- /** |
|
4564 |
- * Set the instance's timezone to UTC. |
|
4565 |
- * |
|
4566 |
- * @return static |
|
4567 |
- */ |
|
4568 |
- public function utc(); |
|
4569 |
- |
|
4570 |
- /** |
|
4571 |
- * Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed. |
|
4572 |
- * |
|
4573 |
- * @param int|null $offset |
|
4574 |
- * |
|
4575 |
- * @return int|static |
|
4576 |
- */ |
|
4577 |
- public function utcOffset(int $offset = null); |
|
4578 |
- |
|
4579 |
- /** |
|
4580 |
- * Returns the milliseconds timestamps used amongst other by Date javascript objects. |
|
4581 |
- * |
|
4582 |
- * @return float |
|
4583 |
- */ |
|
4584 |
- public function valueOf(); |
|
4585 |
- |
|
4586 |
- /** |
|
4587 |
- * Get/set the week number using given first day of week and first |
|
4588 |
- * day of year included in the first week. Or use US format if no settings |
|
4589 |
- * given (Sunday / Jan 6). |
|
4590 |
- * |
|
4591 |
- * @param int|null $week |
|
4592 |
- * @param int|null $dayOfWeek |
|
4593 |
- * @param int|null $dayOfYear |
|
4594 |
- * |
|
4595 |
- * @return int|static |
|
4596 |
- */ |
|
4597 |
- public function week($week = null, $dayOfWeek = null, $dayOfYear = null); |
|
4598 |
- |
|
4599 |
- /** |
|
4600 |
- * Set/get the week number of year using given first day of week and first |
|
4601 |
- * day of year included in the first week. Or use US format if no settings |
|
4602 |
- * given (Sunday / Jan 6). |
|
4603 |
- * |
|
4604 |
- * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. |
|
4605 |
- * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
4606 |
- * @param int|null $dayOfYear first day of year included in the week #1 |
|
4607 |
- * |
|
4608 |
- * @return int|static |
|
4609 |
- */ |
|
4610 |
- public function weekYear($year = null, $dayOfWeek = null, $dayOfYear = null); |
|
4611 |
- |
|
4612 |
- /** |
|
4613 |
- * Get/set the weekday from 0 (Sunday) to 6 (Saturday). |
|
4614 |
- * |
|
4615 |
- * @param int|null $value new value for weekday if using as setter. |
|
4616 |
- * |
|
4617 |
- * @return static|int |
|
4618 |
- */ |
|
4619 |
- public function weekday($value = null); |
|
4620 |
- |
|
4621 |
- /** |
|
4622 |
- * Get the number of weeks of the current week-year using given first day of week and first |
|
4623 |
- * day of year included in the first week. Or use US format if no settings |
|
4624 |
- * given (Sunday / Jan 6). |
|
4625 |
- * |
|
4626 |
- * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
4627 |
- * @param int|null $dayOfYear first day of year included in the week #1 |
|
4628 |
- * |
|
4629 |
- * @return int |
|
4630 |
- */ |
|
4631 |
- public function weeksInYear($dayOfWeek = null, $dayOfYear = null); |
|
4632 |
- |
|
4633 |
- /** |
|
4634 |
- * Create a Carbon instance for yesterday. |
|
4635 |
- * |
|
4636 |
- * @param \DateTimeZone|string|null $tz |
|
4637 |
- * |
|
4638 |
- * @return static |
|
4639 |
- */ |
|
4640 |
- public static function yesterday($tz = null); |
|
4641 |
- |
|
4642 |
- // </methods> |
|
4643 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,4643 @@ |
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 |
+namespace Carbon; |
|
12 |
+ |
|
13 |
+use Closure; |
|
14 |
+use DateInterval; |
|
15 |
+use DateTime; |
|
16 |
+use DateTimeInterface; |
|
17 |
+use InvalidArgumentException; |
|
18 |
+use JsonSerializable; |
|
19 |
+use ReflectionException; |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Common interface for Carbon and CarbonImmutable. |
|
23 |
+ * |
|
24 |
+ * <autodoc generated by `composer phpdoc`> |
|
25 |
+ * |
|
26 |
+ * @property int $year |
|
27 |
+ * @property int $yearIso |
|
28 |
+ * @property int $month |
|
29 |
+ * @property int $day |
|
30 |
+ * @property int $hour |
|
31 |
+ * @property int $minute |
|
32 |
+ * @property int $second |
|
33 |
+ * @property int $micro |
|
34 |
+ * @property int $microsecond |
|
35 |
+ * @property int $timestamp seconds since the Unix Epoch |
|
36 |
+ * @property string $englishDayOfWeek the day of week in English |
|
37 |
+ * @property string $shortEnglishDayOfWeek the abbreviated day of week in English |
|
38 |
+ * @property string $englishMonth the month in English |
|
39 |
+ * @property string $shortEnglishMonth the abbreviated month in English |
|
40 |
+ * @property string $localeDayOfWeek the day of week in current locale LC_TIME |
|
41 |
+ * @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME |
|
42 |
+ * @property string $localeMonth the month in current locale LC_TIME |
|
43 |
+ * @property string $shortLocaleMonth the abbreviated month in current locale LC_TIME |
|
44 |
+ * @property int $milliseconds |
|
45 |
+ * @property int $millisecond |
|
46 |
+ * @property int $milli |
|
47 |
+ * @property int $week 1 through 53 |
|
48 |
+ * @property int $isoWeek 1 through 53 |
|
49 |
+ * @property int $weekYear year according to week format |
|
50 |
+ * @property int $isoWeekYear year according to ISO week format |
|
51 |
+ * @property int $dayOfYear 1 through 366 |
|
52 |
+ * @property int $age does a diffInYears() with default parameters |
|
53 |
+ * @property int $offset the timezone offset in seconds from UTC |
|
54 |
+ * @property int $offsetMinutes the timezone offset in minutes from UTC |
|
55 |
+ * @property int $offsetHours the timezone offset in hours from UTC |
|
56 |
+ * @property CarbonTimeZone $timezone the current timezone |
|
57 |
+ * @property CarbonTimeZone $tz alias of $timezone |
|
58 |
+ * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) |
|
59 |
+ * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) |
|
60 |
+ * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday |
|
61 |
+ * @property-read int $daysInMonth number of days in the given month |
|
62 |
+ * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) |
|
63 |
+ * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) |
|
64 |
+ * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
65 |
+ * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
66 |
+ * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language |
|
67 |
+ * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language |
|
68 |
+ * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language |
|
69 |
+ * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language |
|
70 |
+ * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language |
|
71 |
+ * @property-read int $noZeroHour current hour from 1 to 24 |
|
72 |
+ * @property-read int $weeksInYear 51 through 53 |
|
73 |
+ * @property-read int $isoWeeksInYear 51 through 53 |
|
74 |
+ * @property-read int $weekOfMonth 1 through 5 |
|
75 |
+ * @property-read int $weekNumberInMonth 1 through 5 |
|
76 |
+ * @property-read int $firstWeekDay 0 through 6 |
|
77 |
+ * @property-read int $lastWeekDay 0 through 6 |
|
78 |
+ * @property-read int $daysInYear 365 or 366 |
|
79 |
+ * @property-read int $quarter the quarter of this instance, 1 - 4 |
|
80 |
+ * @property-read int $decade the decade of this instance |
|
81 |
+ * @property-read int $century the century of this instance |
|
82 |
+ * @property-read int $millennium the millennium of this instance |
|
83 |
+ * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise |
|
84 |
+ * @property-read bool $local checks if the timezone is local, true if local, false otherwise |
|
85 |
+ * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise |
|
86 |
+ * @property-read string $timezoneName the current timezone name |
|
87 |
+ * @property-read string $tzName alias of $timezoneName |
|
88 |
+ * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name |
|
89 |
+ * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName |
|
90 |
+ * @property-read string $locale locale of the current instance |
|
91 |
+ * |
|
92 |
+ * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) |
|
93 |
+ * @method bool isLocal() Check if the current instance has non-UTC timezone. |
|
94 |
+ * @method bool isValid() Check if the current instance is a valid date. |
|
95 |
+ * @method bool isDST() Check if the current instance is in a daylight saving time. |
|
96 |
+ * @method bool isSunday() Checks if the instance day is sunday. |
|
97 |
+ * @method bool isMonday() Checks if the instance day is monday. |
|
98 |
+ * @method bool isTuesday() Checks if the instance day is tuesday. |
|
99 |
+ * @method bool isWednesday() Checks if the instance day is wednesday. |
|
100 |
+ * @method bool isThursday() Checks if the instance day is thursday. |
|
101 |
+ * @method bool isFriday() Checks if the instance day is friday. |
|
102 |
+ * @method bool isSaturday() Checks if the instance day is saturday. |
|
103 |
+ * @method bool isSameYear(\DateTimeInterface $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). |
|
104 |
+ * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. |
|
105 |
+ * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. |
|
106 |
+ * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. |
|
107 |
+ * @method bool isSameWeek(\DateTimeInterface $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). |
|
108 |
+ * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. |
|
109 |
+ * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. |
|
110 |
+ * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. |
|
111 |
+ * @method bool isSameDay(\DateTimeInterface $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). |
|
112 |
+ * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. |
|
113 |
+ * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. |
|
114 |
+ * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. |
|
115 |
+ * @method bool isSameHour(\DateTimeInterface $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). |
|
116 |
+ * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. |
|
117 |
+ * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. |
|
118 |
+ * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. |
|
119 |
+ * @method bool isSameMinute(\DateTimeInterface $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). |
|
120 |
+ * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. |
|
121 |
+ * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. |
|
122 |
+ * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. |
|
123 |
+ * @method bool isSameSecond(\DateTimeInterface $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). |
|
124 |
+ * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. |
|
125 |
+ * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. |
|
126 |
+ * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. |
|
127 |
+ * @method bool isSameMicro(\DateTimeInterface $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). |
|
128 |
+ * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. |
|
129 |
+ * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. |
|
130 |
+ * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. |
|
131 |
+ * @method bool isSameMicrosecond(\DateTimeInterface $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). |
|
132 |
+ * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. |
|
133 |
+ * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. |
|
134 |
+ * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. |
|
135 |
+ * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. |
|
136 |
+ * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. |
|
137 |
+ * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. |
|
138 |
+ * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. |
|
139 |
+ * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. |
|
140 |
+ * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. |
|
141 |
+ * @method bool isSameDecade(\DateTimeInterface $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). |
|
142 |
+ * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. |
|
143 |
+ * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. |
|
144 |
+ * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. |
|
145 |
+ * @method bool isSameCentury(\DateTimeInterface $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). |
|
146 |
+ * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. |
|
147 |
+ * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. |
|
148 |
+ * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. |
|
149 |
+ * @method bool isSameMillennium(\DateTimeInterface $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). |
|
150 |
+ * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. |
|
151 |
+ * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. |
|
152 |
+ * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. |
|
153 |
+ * @method $this years(int $value) Set current instance year to the given value. |
|
154 |
+ * @method $this year(int $value) Set current instance year to the given value. |
|
155 |
+ * @method $this setYears(int $value) Set current instance year to the given value. |
|
156 |
+ * @method $this setYear(int $value) Set current instance year to the given value. |
|
157 |
+ * @method $this months(int $value) Set current instance month to the given value. |
|
158 |
+ * @method $this month(int $value) Set current instance month to the given value. |
|
159 |
+ * @method $this setMonths(int $value) Set current instance month to the given value. |
|
160 |
+ * @method $this setMonth(int $value) Set current instance month to the given value. |
|
161 |
+ * @method $this days(int $value) Set current instance day to the given value. |
|
162 |
+ * @method $this day(int $value) Set current instance day to the given value. |
|
163 |
+ * @method $this setDays(int $value) Set current instance day to the given value. |
|
164 |
+ * @method $this setDay(int $value) Set current instance day to the given value. |
|
165 |
+ * @method $this hours(int $value) Set current instance hour to the given value. |
|
166 |
+ * @method $this hour(int $value) Set current instance hour to the given value. |
|
167 |
+ * @method $this setHours(int $value) Set current instance hour to the given value. |
|
168 |
+ * @method $this setHour(int $value) Set current instance hour to the given value. |
|
169 |
+ * @method $this minutes(int $value) Set current instance minute to the given value. |
|
170 |
+ * @method $this minute(int $value) Set current instance minute to the given value. |
|
171 |
+ * @method $this setMinutes(int $value) Set current instance minute to the given value. |
|
172 |
+ * @method $this setMinute(int $value) Set current instance minute to the given value. |
|
173 |
+ * @method $this seconds(int $value) Set current instance second to the given value. |
|
174 |
+ * @method $this second(int $value) Set current instance second to the given value. |
|
175 |
+ * @method $this setSeconds(int $value) Set current instance second to the given value. |
|
176 |
+ * @method $this setSecond(int $value) Set current instance second to the given value. |
|
177 |
+ * @method $this millis(int $value) Set current instance millisecond to the given value. |
|
178 |
+ * @method $this milli(int $value) Set current instance millisecond to the given value. |
|
179 |
+ * @method $this setMillis(int $value) Set current instance millisecond to the given value. |
|
180 |
+ * @method $this setMilli(int $value) Set current instance millisecond to the given value. |
|
181 |
+ * @method $this milliseconds(int $value) Set current instance millisecond to the given value. |
|
182 |
+ * @method $this millisecond(int $value) Set current instance millisecond to the given value. |
|
183 |
+ * @method $this setMilliseconds(int $value) Set current instance millisecond to the given value. |
|
184 |
+ * @method $this setMillisecond(int $value) Set current instance millisecond to the given value. |
|
185 |
+ * @method $this micros(int $value) Set current instance microsecond to the given value. |
|
186 |
+ * @method $this micro(int $value) Set current instance microsecond to the given value. |
|
187 |
+ * @method $this setMicros(int $value) Set current instance microsecond to the given value. |
|
188 |
+ * @method $this setMicro(int $value) Set current instance microsecond to the given value. |
|
189 |
+ * @method $this microseconds(int $value) Set current instance microsecond to the given value. |
|
190 |
+ * @method $this microsecond(int $value) Set current instance microsecond to the given value. |
|
191 |
+ * @method $this setMicroseconds(int $value) Set current instance microsecond to the given value. |
|
192 |
+ * @method $this setMicrosecond(int $value) Set current instance microsecond to the given value. |
|
193 |
+ * @method $this addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). |
|
194 |
+ * @method $this addYear() Add one year to the instance (using date interval). |
|
195 |
+ * @method $this subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). |
|
196 |
+ * @method $this subYear() Sub one year to the instance (using date interval). |
|
197 |
+ * @method $this addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
198 |
+ * @method $this addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. |
|
199 |
+ * @method $this subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
200 |
+ * @method $this subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. |
|
201 |
+ * @method $this addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
202 |
+ * @method $this addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
203 |
+ * @method $this subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
204 |
+ * @method $this subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
205 |
+ * @method $this addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
206 |
+ * @method $this addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
207 |
+ * @method $this subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
208 |
+ * @method $this subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
209 |
+ * @method $this addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
210 |
+ * @method $this addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. |
|
211 |
+ * @method $this subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
212 |
+ * @method $this subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. |
|
213 |
+ * @method $this addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). |
|
214 |
+ * @method $this addMonth() Add one month to the instance (using date interval). |
|
215 |
+ * @method $this subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). |
|
216 |
+ * @method $this subMonth() Sub one month to the instance (using date interval). |
|
217 |
+ * @method $this addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
218 |
+ * @method $this addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. |
|
219 |
+ * @method $this subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
220 |
+ * @method $this subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. |
|
221 |
+ * @method $this addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
222 |
+ * @method $this addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
223 |
+ * @method $this subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
224 |
+ * @method $this subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
225 |
+ * @method $this addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
226 |
+ * @method $this addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
227 |
+ * @method $this subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
228 |
+ * @method $this subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
229 |
+ * @method $this addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
230 |
+ * @method $this addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. |
|
231 |
+ * @method $this subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
232 |
+ * @method $this subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. |
|
233 |
+ * @method $this addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). |
|
234 |
+ * @method $this addDay() Add one day to the instance (using date interval). |
|
235 |
+ * @method $this subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). |
|
236 |
+ * @method $this subDay() Sub one day to the instance (using date interval). |
|
237 |
+ * @method $this addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). |
|
238 |
+ * @method $this addHour() Add one hour to the instance (using date interval). |
|
239 |
+ * @method $this subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). |
|
240 |
+ * @method $this subHour() Sub one hour to the instance (using date interval). |
|
241 |
+ * @method $this addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). |
|
242 |
+ * @method $this addMinute() Add one minute to the instance (using date interval). |
|
243 |
+ * @method $this subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). |
|
244 |
+ * @method $this subMinute() Sub one minute to the instance (using date interval). |
|
245 |
+ * @method $this addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). |
|
246 |
+ * @method $this addSecond() Add one second to the instance (using date interval). |
|
247 |
+ * @method $this subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). |
|
248 |
+ * @method $this subSecond() Sub one second to the instance (using date interval). |
|
249 |
+ * @method $this addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). |
|
250 |
+ * @method $this addMilli() Add one millisecond to the instance (using date interval). |
|
251 |
+ * @method $this subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). |
|
252 |
+ * @method $this subMilli() Sub one millisecond to the instance (using date interval). |
|
253 |
+ * @method $this addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). |
|
254 |
+ * @method $this addMillisecond() Add one millisecond to the instance (using date interval). |
|
255 |
+ * @method $this subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). |
|
256 |
+ * @method $this subMillisecond() Sub one millisecond to the instance (using date interval). |
|
257 |
+ * @method $this addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). |
|
258 |
+ * @method $this addMicro() Add one microsecond to the instance (using date interval). |
|
259 |
+ * @method $this subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). |
|
260 |
+ * @method $this subMicro() Sub one microsecond to the instance (using date interval). |
|
261 |
+ * @method $this addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). |
|
262 |
+ * @method $this addMicrosecond() Add one microsecond to the instance (using date interval). |
|
263 |
+ * @method $this subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). |
|
264 |
+ * @method $this subMicrosecond() Sub one microsecond to the instance (using date interval). |
|
265 |
+ * @method $this addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). |
|
266 |
+ * @method $this addMillennium() Add one millennium to the instance (using date interval). |
|
267 |
+ * @method $this subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). |
|
268 |
+ * @method $this subMillennium() Sub one millennium to the instance (using date interval). |
|
269 |
+ * @method $this addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
270 |
+ * @method $this addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. |
|
271 |
+ * @method $this subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
272 |
+ * @method $this subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. |
|
273 |
+ * @method $this addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
274 |
+ * @method $this addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
275 |
+ * @method $this subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
276 |
+ * @method $this subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
277 |
+ * @method $this addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
278 |
+ * @method $this addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
279 |
+ * @method $this subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
280 |
+ * @method $this subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
281 |
+ * @method $this addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
282 |
+ * @method $this addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
283 |
+ * @method $this subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
284 |
+ * @method $this subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. |
|
285 |
+ * @method $this addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). |
|
286 |
+ * @method $this addCentury() Add one century to the instance (using date interval). |
|
287 |
+ * @method $this subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). |
|
288 |
+ * @method $this subCentury() Sub one century to the instance (using date interval). |
|
289 |
+ * @method $this addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
290 |
+ * @method $this addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. |
|
291 |
+ * @method $this subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
292 |
+ * @method $this subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. |
|
293 |
+ * @method $this addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
294 |
+ * @method $this addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
295 |
+ * @method $this subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
296 |
+ * @method $this subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
297 |
+ * @method $this addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
298 |
+ * @method $this addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
299 |
+ * @method $this subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
300 |
+ * @method $this subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
301 |
+ * @method $this addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
302 |
+ * @method $this addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. |
|
303 |
+ * @method $this subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
304 |
+ * @method $this subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. |
|
305 |
+ * @method $this addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). |
|
306 |
+ * @method $this addDecade() Add one decade to the instance (using date interval). |
|
307 |
+ * @method $this subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). |
|
308 |
+ * @method $this subDecade() Sub one decade to the instance (using date interval). |
|
309 |
+ * @method $this addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
310 |
+ * @method $this addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. |
|
311 |
+ * @method $this subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
312 |
+ * @method $this subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. |
|
313 |
+ * @method $this addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
314 |
+ * @method $this addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
315 |
+ * @method $this subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
316 |
+ * @method $this subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
317 |
+ * @method $this addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
318 |
+ * @method $this addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
319 |
+ * @method $this subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
320 |
+ * @method $this subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
321 |
+ * @method $this addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
322 |
+ * @method $this addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
323 |
+ * @method $this subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
324 |
+ * @method $this subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. |
|
325 |
+ * @method $this addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). |
|
326 |
+ * @method $this addQuarter() Add one quarter to the instance (using date interval). |
|
327 |
+ * @method $this subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). |
|
328 |
+ * @method $this subQuarter() Sub one quarter to the instance (using date interval). |
|
329 |
+ * @method $this addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
330 |
+ * @method $this addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. |
|
331 |
+ * @method $this subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. |
|
332 |
+ * @method $this subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. |
|
333 |
+ * @method $this addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
334 |
+ * @method $this addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
335 |
+ * @method $this subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
336 |
+ * @method $this subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
337 |
+ * @method $this addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
338 |
+ * @method $this addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
339 |
+ * @method $this subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
340 |
+ * @method $this subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
341 |
+ * @method $this addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
342 |
+ * @method $this addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
343 |
+ * @method $this subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. |
|
344 |
+ * @method $this subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. |
|
345 |
+ * @method $this addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). |
|
346 |
+ * @method $this addWeek() Add one week to the instance (using date interval). |
|
347 |
+ * @method $this subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). |
|
348 |
+ * @method $this subWeek() Sub one week to the instance (using date interval). |
|
349 |
+ * @method $this addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). |
|
350 |
+ * @method $this addWeekday() Add one weekday to the instance (using date interval). |
|
351 |
+ * @method $this subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). |
|
352 |
+ * @method $this subWeekday() Sub one weekday to the instance (using date interval). |
|
353 |
+ * @method $this addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). |
|
354 |
+ * @method $this addRealMicro() Add one microsecond to the instance (using timestamp). |
|
355 |
+ * @method $this subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). |
|
356 |
+ * @method $this subRealMicro() Sub one microsecond to the instance (using timestamp). |
|
357 |
+ * @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. |
|
358 |
+ * @method $this addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). |
|
359 |
+ * @method $this addRealMicrosecond() Add one microsecond to the instance (using timestamp). |
|
360 |
+ * @method $this subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). |
|
361 |
+ * @method $this subRealMicrosecond() Sub one microsecond to the instance (using timestamp). |
|
362 |
+ * @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. |
|
363 |
+ * @method $this addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). |
|
364 |
+ * @method $this addRealMilli() Add one millisecond to the instance (using timestamp). |
|
365 |
+ * @method $this subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). |
|
366 |
+ * @method $this subRealMilli() Sub one millisecond to the instance (using timestamp). |
|
367 |
+ * @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. |
|
368 |
+ * @method $this addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). |
|
369 |
+ * @method $this addRealMillisecond() Add one millisecond to the instance (using timestamp). |
|
370 |
+ * @method $this subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). |
|
371 |
+ * @method $this subRealMillisecond() Sub one millisecond to the instance (using timestamp). |
|
372 |
+ * @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. |
|
373 |
+ * @method $this addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). |
|
374 |
+ * @method $this addRealSecond() Add one second to the instance (using timestamp). |
|
375 |
+ * @method $this subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). |
|
376 |
+ * @method $this subRealSecond() Sub one second to the instance (using timestamp). |
|
377 |
+ * @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. |
|
378 |
+ * @method $this addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). |
|
379 |
+ * @method $this addRealMinute() Add one minute to the instance (using timestamp). |
|
380 |
+ * @method $this subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). |
|
381 |
+ * @method $this subRealMinute() Sub one minute to the instance (using timestamp). |
|
382 |
+ * @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. |
|
383 |
+ * @method $this addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). |
|
384 |
+ * @method $this addRealHour() Add one hour to the instance (using timestamp). |
|
385 |
+ * @method $this subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). |
|
386 |
+ * @method $this subRealHour() Sub one hour to the instance (using timestamp). |
|
387 |
+ * @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. |
|
388 |
+ * @method $this addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). |
|
389 |
+ * @method $this addRealDay() Add one day to the instance (using timestamp). |
|
390 |
+ * @method $this subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). |
|
391 |
+ * @method $this subRealDay() Sub one day to the instance (using timestamp). |
|
392 |
+ * @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. |
|
393 |
+ * @method $this addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). |
|
394 |
+ * @method $this addRealWeek() Add one week to the instance (using timestamp). |
|
395 |
+ * @method $this subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). |
|
396 |
+ * @method $this subRealWeek() Sub one week to the instance (using timestamp). |
|
397 |
+ * @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. |
|
398 |
+ * @method $this addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). |
|
399 |
+ * @method $this addRealMonth() Add one month to the instance (using timestamp). |
|
400 |
+ * @method $this subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). |
|
401 |
+ * @method $this subRealMonth() Sub one month to the instance (using timestamp). |
|
402 |
+ * @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. |
|
403 |
+ * @method $this addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). |
|
404 |
+ * @method $this addRealQuarter() Add one quarter to the instance (using timestamp). |
|
405 |
+ * @method $this subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). |
|
406 |
+ * @method $this subRealQuarter() Sub one quarter to the instance (using timestamp). |
|
407 |
+ * @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. |
|
408 |
+ * @method $this addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). |
|
409 |
+ * @method $this addRealYear() Add one year to the instance (using timestamp). |
|
410 |
+ * @method $this subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). |
|
411 |
+ * @method $this subRealYear() Sub one year to the instance (using timestamp). |
|
412 |
+ * @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. |
|
413 |
+ * @method $this addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). |
|
414 |
+ * @method $this addRealDecade() Add one decade to the instance (using timestamp). |
|
415 |
+ * @method $this subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). |
|
416 |
+ * @method $this subRealDecade() Sub one decade to the instance (using timestamp). |
|
417 |
+ * @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. |
|
418 |
+ * @method $this addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). |
|
419 |
+ * @method $this addRealCentury() Add one century to the instance (using timestamp). |
|
420 |
+ * @method $this subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). |
|
421 |
+ * @method $this subRealCentury() Sub one century to the instance (using timestamp). |
|
422 |
+ * @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. |
|
423 |
+ * @method $this addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). |
|
424 |
+ * @method $this addRealMillennium() Add one millennium to the instance (using timestamp). |
|
425 |
+ * @method $this subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). |
|
426 |
+ * @method $this subRealMillennium() Sub one millennium to the instance (using timestamp). |
|
427 |
+ * @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. |
|
428 |
+ * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. |
|
429 |
+ * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. |
|
430 |
+ * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. |
|
431 |
+ * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. |
|
432 |
+ * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. |
|
433 |
+ * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. |
|
434 |
+ * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. |
|
435 |
+ * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. |
|
436 |
+ * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. |
|
437 |
+ * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. |
|
438 |
+ * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. |
|
439 |
+ * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. |
|
440 |
+ * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. |
|
441 |
+ * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. |
|
442 |
+ * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. |
|
443 |
+ * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. |
|
444 |
+ * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. |
|
445 |
+ * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. |
|
446 |
+ * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. |
|
447 |
+ * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. |
|
448 |
+ * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. |
|
449 |
+ * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. |
|
450 |
+ * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. |
|
451 |
+ * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. |
|
452 |
+ * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. |
|
453 |
+ * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. |
|
454 |
+ * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. |
|
455 |
+ * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. |
|
456 |
+ * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. |
|
457 |
+ * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. |
|
458 |
+ * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. |
|
459 |
+ * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. |
|
460 |
+ * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. |
|
461 |
+ * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. |
|
462 |
+ * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. |
|
463 |
+ * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. |
|
464 |
+ * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. |
|
465 |
+ * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. |
|
466 |
+ * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. |
|
467 |
+ * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. |
|
468 |
+ * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. |
|
469 |
+ * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. |
|
470 |
+ * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. |
|
471 |
+ * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. |
|
472 |
+ * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. |
|
473 |
+ * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. |
|
474 |
+ * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. |
|
475 |
+ * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. |
|
476 |
+ * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. |
|
477 |
+ * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. |
|
478 |
+ * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. |
|
479 |
+ * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. |
|
480 |
+ * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. |
|
481 |
+ * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. |
|
482 |
+ * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. |
|
483 |
+ * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. |
|
484 |
+ * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. |
|
485 |
+ * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. |
|
486 |
+ * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. |
|
487 |
+ * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. |
|
488 |
+ * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. |
|
489 |
+ * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. |
|
490 |
+ * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. |
|
491 |
+ * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. |
|
492 |
+ * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. |
|
493 |
+ * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. |
|
494 |
+ * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. |
|
495 |
+ * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. |
|
496 |
+ * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. |
|
497 |
+ * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. |
|
498 |
+ * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. |
|
499 |
+ * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. |
|
500 |
+ * @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.) |
|
501 |
+ * @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.) |
|
502 |
+ * @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.) |
|
503 |
+ * @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.) |
|
504 |
+ * @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.) |
|
505 |
+ * @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.) |
|
506 |
+ * @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.) |
|
507 |
+ * @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.) |
|
508 |
+ * |
|
509 |
+ * </autodoc> |
|
510 |
+ */ |
|
511 |
+interface CarbonInterface extends DateTimeInterface, JsonSerializable |
|
512 |
+{ |
|
513 |
+ /** |
|
514 |
+ * Diff wording options(expressed in octal). |
|
515 |
+ */ |
|
516 |
+ public const NO_ZERO_DIFF = 01; |
|
517 |
+ public const JUST_NOW = 02; |
|
518 |
+ public const ONE_DAY_WORDS = 04; |
|
519 |
+ public const TWO_DAY_WORDS = 010; |
|
520 |
+ public const SEQUENTIAL_PARTS_ONLY = 020; |
|
521 |
+ |
|
522 |
+ /** |
|
523 |
+ * Diff syntax options. |
|
524 |
+ */ |
|
525 |
+ public const DIFF_ABSOLUTE = 1; // backward compatibility with true |
|
526 |
+ public const DIFF_RELATIVE_AUTO = 0; // backward compatibility with false |
|
527 |
+ public const DIFF_RELATIVE_TO_NOW = 2; |
|
528 |
+ public const DIFF_RELATIVE_TO_OTHER = 3; |
|
529 |
+ |
|
530 |
+ /** |
|
531 |
+ * Translate string options. |
|
532 |
+ */ |
|
533 |
+ public const TRANSLATE_MONTHS = 1; |
|
534 |
+ public const TRANSLATE_DAYS = 2; |
|
535 |
+ public const TRANSLATE_UNITS = 4; |
|
536 |
+ public const TRANSLATE_MERIDIEM = 8; |
|
537 |
+ public const TRANSLATE_ALL = self::TRANSLATE_MONTHS | self::TRANSLATE_DAYS | self::TRANSLATE_UNITS | self::TRANSLATE_MERIDIEM; |
|
538 |
+ |
|
539 |
+ /** |
|
540 |
+ * The day constants. |
|
541 |
+ */ |
|
542 |
+ public const SUNDAY = 0; |
|
543 |
+ public const MONDAY = 1; |
|
544 |
+ public const TUESDAY = 2; |
|
545 |
+ public const WEDNESDAY = 3; |
|
546 |
+ public const THURSDAY = 4; |
|
547 |
+ public const FRIDAY = 5; |
|
548 |
+ public const SATURDAY = 6; |
|
549 |
+ |
|
550 |
+ /** |
|
551 |
+ * Number of X in Y. |
|
552 |
+ */ |
|
553 |
+ public const YEARS_PER_MILLENNIUM = 1000; |
|
554 |
+ public const YEARS_PER_CENTURY = 100; |
|
555 |
+ public const YEARS_PER_DECADE = 10; |
|
556 |
+ public const MONTHS_PER_YEAR = 12; |
|
557 |
+ public const MONTHS_PER_QUARTER = 3; |
|
558 |
+ public const WEEKS_PER_YEAR = 52; |
|
559 |
+ public const WEEKS_PER_MONTH = 4; |
|
560 |
+ public const DAYS_PER_WEEK = 7; |
|
561 |
+ public const HOURS_PER_DAY = 24; |
|
562 |
+ public const MINUTES_PER_HOUR = 60; |
|
563 |
+ public const SECONDS_PER_MINUTE = 60; |
|
564 |
+ public const MILLISECONDS_PER_SECOND = 1000; |
|
565 |
+ public const MICROSECONDS_PER_MILLISECOND = 1000; |
|
566 |
+ public const MICROSECONDS_PER_SECOND = 1000000; |
|
567 |
+ |
|
568 |
+ /** |
|
569 |
+ * RFC7231 DateTime format. |
|
570 |
+ * |
|
571 |
+ * @var string |
|
572 |
+ */ |
|
573 |
+ public const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T'; |
|
574 |
+ |
|
575 |
+ /** |
|
576 |
+ * Default format to use for __toString method when type juggling occurs. |
|
577 |
+ * |
|
578 |
+ * @var string |
|
579 |
+ */ |
|
580 |
+ public const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s'; |
|
581 |
+ |
|
582 |
+ /** |
|
583 |
+ * Format for converting mocked time, includes microseconds. |
|
584 |
+ * |
|
585 |
+ * @var string |
|
586 |
+ */ |
|
587 |
+ public const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u'; |
|
588 |
+ |
|
589 |
+ /** |
|
590 |
+ * Pattern detection for ->isoFormat and ::createFromIsoFormat. |
|
591 |
+ * |
|
592 |
+ * @var string |
|
593 |
+ */ |
|
594 |
+ 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?)'; |
|
595 |
+ |
|
596 |
+ // <methods> |
|
597 |
+ |
|
598 |
+ /** |
|
599 |
+ * Dynamically handle calls to the class. |
|
600 |
+ * |
|
601 |
+ * @param string $method magic method name called |
|
602 |
+ * @param array $parameters parameters list |
|
603 |
+ * |
|
604 |
+ * @throws \BadMethodCallException|\ReflectionException |
|
605 |
+ * |
|
606 |
+ * @return mixed |
|
607 |
+ */ |
|
608 |
+ public function __call($method, $parameters); |
|
609 |
+ |
|
610 |
+ /** |
|
611 |
+ * Dynamically handle calls to the class. |
|
612 |
+ * |
|
613 |
+ * @param string $method magic method name called |
|
614 |
+ * @param array $parameters parameters list |
|
615 |
+ * |
|
616 |
+ * @throws \BadMethodCallException |
|
617 |
+ * |
|
618 |
+ * @return mixed |
|
619 |
+ */ |
|
620 |
+ public static function __callStatic($method, $parameters); |
|
621 |
+ |
|
622 |
+ /** |
|
623 |
+ * Create a new Carbon instance. |
|
624 |
+ * |
|
625 |
+ * Please see the testing aids section (specifically static::setTestNow()) |
|
626 |
+ * for more on the possibility of this constructor returning a test instance. |
|
627 |
+ * |
|
628 |
+ * @param string|null $time |
|
629 |
+ * @param \DateTimeZone|string|null $tz |
|
630 |
+ */ |
|
631 |
+ public function __construct($time = null, $tz = null); |
|
632 |
+ |
|
633 |
+ /** |
|
634 |
+ * Show truthy properties on var_dump(). |
|
635 |
+ * |
|
636 |
+ * @return array |
|
637 |
+ */ |
|
638 |
+ public function __debugInfo(); |
|
639 |
+ |
|
640 |
+ /** |
|
641 |
+ * Get a part of the Carbon object |
|
642 |
+ * |
|
643 |
+ * @param string $name |
|
644 |
+ * |
|
645 |
+ * @throws InvalidArgumentException|ReflectionException |
|
646 |
+ * |
|
647 |
+ * @return string|int|bool|\DateTimeZone|null |
|
648 |
+ */ |
|
649 |
+ public function __get($name); |
|
650 |
+ |
|
651 |
+ /** |
|
652 |
+ * Check if an attribute exists on the object |
|
653 |
+ * |
|
654 |
+ * @param string $name |
|
655 |
+ * |
|
656 |
+ * @return bool |
|
657 |
+ */ |
|
658 |
+ public function __isset($name); |
|
659 |
+ |
|
660 |
+ /** |
|
661 |
+ * Set a part of the Carbon object |
|
662 |
+ * |
|
663 |
+ * @param string $name |
|
664 |
+ * @param string|int|\DateTimeZone $value |
|
665 |
+ * |
|
666 |
+ * @throws InvalidArgumentException|ReflectionException |
|
667 |
+ * |
|
668 |
+ * @return void |
|
669 |
+ */ |
|
670 |
+ public function __set($name, $value); |
|
671 |
+ |
|
672 |
+ /** |
|
673 |
+ * The __set_state handler. |
|
674 |
+ * |
|
675 |
+ * @param string|array $dump |
|
676 |
+ * |
|
677 |
+ * @return static |
|
678 |
+ */ |
|
679 |
+ public static function __set_state($dump); |
|
680 |
+ |
|
681 |
+ /** |
|
682 |
+ * Returns the list of properties to dump on serialize() called on. |
|
683 |
+ * |
|
684 |
+ * @return array |
|
685 |
+ */ |
|
686 |
+ public function __sleep(); |
|
687 |
+ |
|
688 |
+ /** |
|
689 |
+ * Format the instance as a string using the set format |
|
690 |
+ * |
|
691 |
+ * @example |
|
692 |
+ * ``` |
|
693 |
+ * echo Carbon::now(); // Carbon instances can be casted to string |
|
694 |
+ * ``` |
|
695 |
+ * |
|
696 |
+ * @return string |
|
697 |
+ */ |
|
698 |
+ public function __toString(); |
|
699 |
+ |
|
700 |
+ /** |
|
701 |
+ * Add given units or interval to the current instance. |
|
702 |
+ * |
|
703 |
+ * @example $date->add('hour', 3) |
|
704 |
+ * @example $date->add(15, 'days') |
|
705 |
+ * @example $date->add(CarbonInterval::days(4)) |
|
706 |
+ * |
|
707 |
+ * @param string|DateInterval $unit |
|
708 |
+ * @param int $value |
|
709 |
+ * @param bool|null $overflow |
|
710 |
+ * |
|
711 |
+ * @return CarbonInterface |
|
712 |
+ */ |
|
713 |
+ public function add($unit, $value = 1, $overflow = null); |
|
714 |
+ |
|
715 |
+ /** |
|
716 |
+ * Add seconds to the instance using timestamp. Positive $value travels |
|
717 |
+ * forward while negative $value travels into the past. |
|
718 |
+ * |
|
719 |
+ * @param string $unit |
|
720 |
+ * @param int $value |
|
721 |
+ * |
|
722 |
+ * @return static |
|
723 |
+ */ |
|
724 |
+ public function addRealUnit($unit, $value = 1); |
|
725 |
+ |
|
726 |
+ /** |
|
727 |
+ * Add given units to the current instance. |
|
728 |
+ * |
|
729 |
+ * @param string $unit |
|
730 |
+ * @param int $value |
|
731 |
+ * @param bool|null $overflow |
|
732 |
+ * |
|
733 |
+ * @return CarbonInterface |
|
734 |
+ */ |
|
735 |
+ public function addUnit($unit, $value = 1, $overflow = null); |
|
736 |
+ |
|
737 |
+ /** |
|
738 |
+ * Add any unit to a new value without overflowing current other unit given. |
|
739 |
+ * |
|
740 |
+ * @param string $valueUnit unit name to modify |
|
741 |
+ * @param int $value amount to add to the input unit |
|
742 |
+ * @param string $overflowUnit unit name to not overflow |
|
743 |
+ * |
|
744 |
+ * @return static |
|
745 |
+ */ |
|
746 |
+ public function addUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
747 |
+ |
|
748 |
+ /** |
|
749 |
+ * Get the difference in a human readable format in the current locale from an other |
|
750 |
+ * instance given to now |
|
751 |
+ * |
|
752 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
753 |
+ * - 'syntax' entry (see below) |
|
754 |
+ * - 'short' entry (see below) |
|
755 |
+ * - 'parts' entry (see below) |
|
756 |
+ * - 'options' entry (see below) |
|
757 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
758 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
759 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
760 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
761 |
+ * ` will be used instead of the glue for the last item |
|
762 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
763 |
+ * ` - if $join is missing, a space will be used as glue |
|
764 |
+ * if int passed, it add modifiers: |
|
765 |
+ * Possible values: |
|
766 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
767 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
768 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
769 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
770 |
+ * @param bool $short displays short format of time units |
|
771 |
+ * @param int $parts maximum number of parts to display (default value: 1: single part) |
|
772 |
+ * @param int $options human diff options |
|
773 |
+ * |
|
774 |
+ * @return string |
|
775 |
+ */ |
|
776 |
+ public function ago($syntax = null, $short = false, $parts = 1, $options = null); |
|
777 |
+ |
|
778 |
+ /** |
|
779 |
+ * Modify the current instance to the average of a given instance (default now) and the current instance |
|
780 |
+ * (second-precision). |
|
781 |
+ * |
|
782 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date |
|
783 |
+ * |
|
784 |
+ * @return static |
|
785 |
+ */ |
|
786 |
+ public function average($date = null); |
|
787 |
+ |
|
788 |
+ /** |
|
789 |
+ * Determines if the instance is between two others |
|
790 |
+ * |
|
791 |
+ * @example |
|
792 |
+ * ``` |
|
793 |
+ * Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true |
|
794 |
+ * Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false |
|
795 |
+ * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // false |
|
796 |
+ * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', true); // true |
|
797 |
+ * ``` |
|
798 |
+ * |
|
799 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
800 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
801 |
+ * @param bool $equal Indicates if an equal to comparison should be done |
|
802 |
+ * |
|
803 |
+ * @return bool |
|
804 |
+ */ |
|
805 |
+ public function between($date1, $date2, $equal = true): bool; |
|
806 |
+ |
|
807 |
+ /** |
|
808 |
+ * Returns either the close date "Friday 15h30", or a calendar date "10/09/2017" is farthest than 7 days from now. |
|
809 |
+ * |
|
810 |
+ * @param Carbon|\DateTimeInterface|string|null $referenceTime |
|
811 |
+ * @param array $formats |
|
812 |
+ * |
|
813 |
+ * @return string |
|
814 |
+ */ |
|
815 |
+ public function calendar($referenceTime = null, array $formats = []); |
|
816 |
+ |
|
817 |
+ /** |
|
818 |
+ * Cast the current instance into the given class. |
|
819 |
+ * |
|
820 |
+ * @param string $className The $className::instance() method will be called to cast the current object. |
|
821 |
+ * |
|
822 |
+ * @return object |
|
823 |
+ */ |
|
824 |
+ public function cast(string $className); |
|
825 |
+ |
|
826 |
+ /** |
|
827 |
+ * Ceil the current instance second with given precision if specified. |
|
828 |
+ * |
|
829 |
+ * @param float|int $precision |
|
830 |
+ * |
|
831 |
+ * @return CarbonInterface |
|
832 |
+ */ |
|
833 |
+ public function ceil($precision = 1); |
|
834 |
+ |
|
835 |
+ /** |
|
836 |
+ * Ceil the current instance at the given unit with given precision if specified. |
|
837 |
+ * |
|
838 |
+ * @param string $unit |
|
839 |
+ * @param float|int $precision |
|
840 |
+ * |
|
841 |
+ * @return CarbonInterface |
|
842 |
+ */ |
|
843 |
+ public function ceilUnit($unit, $precision = 1); |
|
844 |
+ |
|
845 |
+ /** |
|
846 |
+ * Ceil the current instance week. |
|
847 |
+ * |
|
848 |
+ * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
849 |
+ * |
|
850 |
+ * @return CarbonInterface |
|
851 |
+ */ |
|
852 |
+ public function ceilWeek($weekStartsAt = null); |
|
853 |
+ |
|
854 |
+ /** |
|
855 |
+ * Similar to native modify() method of DateTime but can handle more grammars. |
|
856 |
+ * |
|
857 |
+ * @example |
|
858 |
+ * ``` |
|
859 |
+ * echo Carbon::now()->change('next 2pm'); |
|
860 |
+ * ``` |
|
861 |
+ * |
|
862 |
+ * @link https://php.net/manual/en/datetime.modify.php |
|
863 |
+ * |
|
864 |
+ * @param string $modifier |
|
865 |
+ * |
|
866 |
+ * @return static |
|
867 |
+ */ |
|
868 |
+ public function change($modifier); |
|
869 |
+ |
|
870 |
+ /** |
|
871 |
+ * @alias copy |
|
872 |
+ * |
|
873 |
+ * Get a copy of the instance. |
|
874 |
+ * |
|
875 |
+ * @return static |
|
876 |
+ */ |
|
877 |
+ public function clone(); |
|
878 |
+ |
|
879 |
+ /** |
|
880 |
+ * Get the closest date from the instance (second-precision). |
|
881 |
+ * |
|
882 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
883 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
884 |
+ * |
|
885 |
+ * @return static |
|
886 |
+ */ |
|
887 |
+ public function closest($date1, $date2); |
|
888 |
+ |
|
889 |
+ /** |
|
890 |
+ * Get a copy of the instance. |
|
891 |
+ * |
|
892 |
+ * @return static |
|
893 |
+ */ |
|
894 |
+ public function copy(); |
|
895 |
+ |
|
896 |
+ /** |
|
897 |
+ * Create a new Carbon instance from a specific date and time. |
|
898 |
+ * |
|
899 |
+ * If any of $year, $month or $day are set to null their now() values will |
|
900 |
+ * be used. |
|
901 |
+ * |
|
902 |
+ * If $hour is null it will be set to its now() value and the default |
|
903 |
+ * values for $minute and $second will be their now() values. |
|
904 |
+ * |
|
905 |
+ * If $hour is not null then the default values for $minute and $second |
|
906 |
+ * will be 0. |
|
907 |
+ * |
|
908 |
+ * @param int|null $year |
|
909 |
+ * @param int|null $month |
|
910 |
+ * @param int|null $day |
|
911 |
+ * @param int|null $hour |
|
912 |
+ * @param int|null $minute |
|
913 |
+ * @param int|null $second |
|
914 |
+ * @param \DateTimeZone|string|null $tz |
|
915 |
+ * |
|
916 |
+ * @throws \InvalidArgumentException |
|
917 |
+ * |
|
918 |
+ * @return static |
|
919 |
+ */ |
|
920 |
+ public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null); |
|
921 |
+ |
|
922 |
+ /** |
|
923 |
+ * Create a Carbon instance from just a date. The time portion is set to now. |
|
924 |
+ * |
|
925 |
+ * @param int|null $year |
|
926 |
+ * @param int|null $month |
|
927 |
+ * @param int|null $day |
|
928 |
+ * @param \DateTimeZone|string|null $tz |
|
929 |
+ * |
|
930 |
+ * @throws \InvalidArgumentException |
|
931 |
+ * |
|
932 |
+ * @return static |
|
933 |
+ */ |
|
934 |
+ public static function createFromDate($year = null, $month = null, $day = null, $tz = null); |
|
935 |
+ |
|
936 |
+ /** |
|
937 |
+ * Create a Carbon instance from a specific format. |
|
938 |
+ * |
|
939 |
+ * @param string $format Datetime format |
|
940 |
+ * @param string $time |
|
941 |
+ * @param \DateTimeZone|string|false|null $tz |
|
942 |
+ * |
|
943 |
+ * @throws InvalidArgumentException |
|
944 |
+ * |
|
945 |
+ * @return static|false |
|
946 |
+ */ |
|
947 |
+ public static function createFromFormat($format, $time, $tz = null); |
|
948 |
+ |
|
949 |
+ /** |
|
950 |
+ * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). |
|
951 |
+ * |
|
952 |
+ * @param string $format Datetime format |
|
953 |
+ * @param string $time |
|
954 |
+ * @param \DateTimeZone|string|false|null $tz optional timezone |
|
955 |
+ * @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) |
|
956 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator optional custom translator to use for macro-formats |
|
957 |
+ * |
|
958 |
+ * @throws InvalidArgumentException |
|
959 |
+ * |
|
960 |
+ * @return static|false |
|
961 |
+ */ |
|
962 |
+ public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null); |
|
963 |
+ |
|
964 |
+ /** |
|
965 |
+ * Create a Carbon instance from a specific format and a string in a given language. |
|
966 |
+ * |
|
967 |
+ * @param string $format Datetime format |
|
968 |
+ * @param string $locale |
|
969 |
+ * @param string $time |
|
970 |
+ * @param \DateTimeZone|string|false|null $tz |
|
971 |
+ * |
|
972 |
+ * @throws InvalidArgumentException |
|
973 |
+ * |
|
974 |
+ * @return static|false |
|
975 |
+ */ |
|
976 |
+ public static function createFromLocaleFormat($format, $locale, $time, $tz = null); |
|
977 |
+ |
|
978 |
+ /** |
|
979 |
+ * Create a Carbon instance from a specific ISO format and a string in a given language. |
|
980 |
+ * |
|
981 |
+ * @param string $format Datetime ISO format |
|
982 |
+ * @param string $locale |
|
983 |
+ * @param string $time |
|
984 |
+ * @param \DateTimeZone|string|false|null $tz |
|
985 |
+ * |
|
986 |
+ * @throws InvalidArgumentException |
|
987 |
+ * |
|
988 |
+ * @return static|false |
|
989 |
+ */ |
|
990 |
+ public static function createFromLocaleIsoFormat($format, $locale, $time, $tz = null); |
|
991 |
+ |
|
992 |
+ /** |
|
993 |
+ * Create a Carbon instance from just a time. The date portion is set to today. |
|
994 |
+ * |
|
995 |
+ * @param int|null $hour |
|
996 |
+ * @param int|null $minute |
|
997 |
+ * @param int|null $second |
|
998 |
+ * @param \DateTimeZone|string|null $tz |
|
999 |
+ * |
|
1000 |
+ * @throws \InvalidArgumentException |
|
1001 |
+ * |
|
1002 |
+ * @return static |
|
1003 |
+ */ |
|
1004 |
+ public static function createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null); |
|
1005 |
+ |
|
1006 |
+ /** |
|
1007 |
+ * Create a Carbon instance from a time string. The date portion is set to today. |
|
1008 |
+ * |
|
1009 |
+ * @param string $time |
|
1010 |
+ * @param \DateTimeZone|string|null $tz |
|
1011 |
+ * |
|
1012 |
+ * @throws \InvalidArgumentException |
|
1013 |
+ * |
|
1014 |
+ * @return static |
|
1015 |
+ */ |
|
1016 |
+ public static function createFromTimeString($time, $tz = null); |
|
1017 |
+ |
|
1018 |
+ /** |
|
1019 |
+ * Create a Carbon instance from a timestamp. |
|
1020 |
+ * |
|
1021 |
+ * @param int $timestamp |
|
1022 |
+ * @param \DateTimeZone|string|null $tz |
|
1023 |
+ * |
|
1024 |
+ * @return static |
|
1025 |
+ */ |
|
1026 |
+ public static function createFromTimestamp($timestamp, $tz = null); |
|
1027 |
+ |
|
1028 |
+ /** |
|
1029 |
+ * Create a Carbon instance from a timestamp in milliseconds. |
|
1030 |
+ * |
|
1031 |
+ * @param int $timestamp |
|
1032 |
+ * @param \DateTimeZone|string|null $tz |
|
1033 |
+ * |
|
1034 |
+ * @return static |
|
1035 |
+ */ |
|
1036 |
+ public static function createFromTimestampMs($timestamp, $tz = null); |
|
1037 |
+ |
|
1038 |
+ /** |
|
1039 |
+ * Create a Carbon instance from an UTC timestamp. |
|
1040 |
+ * |
|
1041 |
+ * @param int $timestamp |
|
1042 |
+ * |
|
1043 |
+ * @return static |
|
1044 |
+ */ |
|
1045 |
+ public static function createFromTimestampUTC($timestamp); |
|
1046 |
+ |
|
1047 |
+ /** |
|
1048 |
+ * Create a Carbon instance from just a date. The time portion is set to midnight. |
|
1049 |
+ * |
|
1050 |
+ * @param int|null $year |
|
1051 |
+ * @param int|null $month |
|
1052 |
+ * @param int|null $day |
|
1053 |
+ * @param \DateTimeZone|string|null $tz |
|
1054 |
+ * |
|
1055 |
+ * @return static |
|
1056 |
+ */ |
|
1057 |
+ public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null); |
|
1058 |
+ |
|
1059 |
+ /** |
|
1060 |
+ * Create a new safe Carbon instance from a specific date and time. |
|
1061 |
+ * |
|
1062 |
+ * If any of $year, $month or $day are set to null their now() values will |
|
1063 |
+ * be used. |
|
1064 |
+ * |
|
1065 |
+ * If $hour is null it will be set to its now() value and the default |
|
1066 |
+ * values for $minute and $second will be their now() values. |
|
1067 |
+ * |
|
1068 |
+ * If $hour is not null then the default values for $minute and $second |
|
1069 |
+ * will be 0. |
|
1070 |
+ * |
|
1071 |
+ * If one of the set values is not valid, an \InvalidArgumentException |
|
1072 |
+ * will be thrown. |
|
1073 |
+ * |
|
1074 |
+ * @param int|null $year |
|
1075 |
+ * @param int|null $month |
|
1076 |
+ * @param int|null $day |
|
1077 |
+ * @param int|null $hour |
|
1078 |
+ * @param int|null $minute |
|
1079 |
+ * @param int|null $second |
|
1080 |
+ * @param \DateTimeZone|string|null $tz |
|
1081 |
+ * |
|
1082 |
+ * @throws \Carbon\Exceptions\InvalidDateException|\InvalidArgumentException |
|
1083 |
+ * |
|
1084 |
+ * @return static|false |
|
1085 |
+ */ |
|
1086 |
+ public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null); |
|
1087 |
+ |
|
1088 |
+ /** |
|
1089 |
+ * Get/set the day of year. |
|
1090 |
+ * |
|
1091 |
+ * @param int|null $value new value for day of year if using as setter. |
|
1092 |
+ * |
|
1093 |
+ * @return static|int |
|
1094 |
+ */ |
|
1095 |
+ public function dayOfYear($value = null); |
|
1096 |
+ |
|
1097 |
+ /** |
|
1098 |
+ * Get the difference as a CarbonInterval instance |
|
1099 |
+ * |
|
1100 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1101 |
+ * @param bool $absolute Get the absolute of the difference |
|
1102 |
+ * |
|
1103 |
+ * @return CarbonInterval |
|
1104 |
+ */ |
|
1105 |
+ public function diffAsCarbonInterval($date = null, $absolute = true); |
|
1106 |
+ |
|
1107 |
+ /** |
|
1108 |
+ * Get the difference by the given interval using a filter closure |
|
1109 |
+ * |
|
1110 |
+ * @param CarbonInterval $ci An interval to traverse by |
|
1111 |
+ * @param Closure $callback |
|
1112 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1113 |
+ * @param bool $absolute Get the absolute of the difference |
|
1114 |
+ * |
|
1115 |
+ * @return int |
|
1116 |
+ */ |
|
1117 |
+ public function diffFiltered(CarbonInterval $ci, \Closure $callback, $date = null, $absolute = true); |
|
1118 |
+ |
|
1119 |
+ /** |
|
1120 |
+ * Get the difference in a human readable format in the current locale from current instance to an other |
|
1121 |
+ * instance given (or now if null given). |
|
1122 |
+ * |
|
1123 |
+ * @example |
|
1124 |
+ * ``` |
|
1125 |
+ * echo Carbon::tomorrow()->diffForHumans() . "\n"; |
|
1126 |
+ * echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n"; |
|
1127 |
+ * echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n"; |
|
1128 |
+ * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n"; |
|
1129 |
+ * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n"; |
|
1130 |
+ * ``` |
|
1131 |
+ * |
|
1132 |
+ * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
1133 |
+ * if null passed, now will be used as comparison reference; |
|
1134 |
+ * if any other type, it will be converted to date and used as reference. |
|
1135 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1136 |
+ * - 'syntax' entry (see below) |
|
1137 |
+ * - 'short' entry (see below) |
|
1138 |
+ * - 'parts' entry (see below) |
|
1139 |
+ * - 'options' entry (see below) |
|
1140 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
1141 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
1142 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1143 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1144 |
+ * ` will be used instead of the glue for the last item |
|
1145 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1146 |
+ * ` - if $join is missing, a space will be used as glue |
|
1147 |
+ * - 'other' entry (see above) |
|
1148 |
+ * if int passed, it add modifiers: |
|
1149 |
+ * Possible values: |
|
1150 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1151 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1152 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1153 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1154 |
+ * @param bool $short displays short format of time units |
|
1155 |
+ * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1156 |
+ * @param int $options human diff options |
|
1157 |
+ * |
|
1158 |
+ * @return string |
|
1159 |
+ */ |
|
1160 |
+ public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
1161 |
+ |
|
1162 |
+ /** |
|
1163 |
+ * Get the difference in days |
|
1164 |
+ * |
|
1165 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1166 |
+ * @param bool $absolute Get the absolute of the difference |
|
1167 |
+ * |
|
1168 |
+ * @return int |
|
1169 |
+ */ |
|
1170 |
+ public function diffInDays($date = null, $absolute = true); |
|
1171 |
+ |
|
1172 |
+ /** |
|
1173 |
+ * Get the difference in days using a filter closure |
|
1174 |
+ * |
|
1175 |
+ * @param Closure $callback |
|
1176 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1177 |
+ * @param bool $absolute Get the absolute of the difference |
|
1178 |
+ * |
|
1179 |
+ * @return int |
|
1180 |
+ */ |
|
1181 |
+ public function diffInDaysFiltered(\Closure $callback, $date = null, $absolute = true); |
|
1182 |
+ |
|
1183 |
+ /** |
|
1184 |
+ * Get the difference in hours. |
|
1185 |
+ * |
|
1186 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1187 |
+ * @param bool $absolute Get the absolute of the difference |
|
1188 |
+ * |
|
1189 |
+ * @return int |
|
1190 |
+ */ |
|
1191 |
+ public function diffInHours($date = null, $absolute = true); |
|
1192 |
+ |
|
1193 |
+ /** |
|
1194 |
+ * Get the difference in hours using a filter closure |
|
1195 |
+ * |
|
1196 |
+ * @param Closure $callback |
|
1197 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1198 |
+ * @param bool $absolute Get the absolute of the difference |
|
1199 |
+ * |
|
1200 |
+ * @return int |
|
1201 |
+ */ |
|
1202 |
+ public function diffInHoursFiltered(\Closure $callback, $date = null, $absolute = true); |
|
1203 |
+ |
|
1204 |
+ /** |
|
1205 |
+ * Get the difference in microseconds. |
|
1206 |
+ * |
|
1207 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1208 |
+ * @param bool $absolute Get the absolute of the difference |
|
1209 |
+ * |
|
1210 |
+ * @return int |
|
1211 |
+ */ |
|
1212 |
+ public function diffInMicroseconds($date = null, $absolute = true); |
|
1213 |
+ |
|
1214 |
+ /** |
|
1215 |
+ * Get the difference in milliseconds. |
|
1216 |
+ * |
|
1217 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1218 |
+ * @param bool $absolute Get the absolute of the difference |
|
1219 |
+ * |
|
1220 |
+ * @return int |
|
1221 |
+ */ |
|
1222 |
+ public function diffInMilliseconds($date = null, $absolute = true); |
|
1223 |
+ |
|
1224 |
+ /** |
|
1225 |
+ * Get the difference in minutes. |
|
1226 |
+ * |
|
1227 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1228 |
+ * @param bool $absolute Get the absolute of the difference |
|
1229 |
+ * |
|
1230 |
+ * @return int |
|
1231 |
+ */ |
|
1232 |
+ public function diffInMinutes($date = null, $absolute = true); |
|
1233 |
+ |
|
1234 |
+ /** |
|
1235 |
+ * Get the difference in months |
|
1236 |
+ * |
|
1237 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1238 |
+ * @param bool $absolute Get the absolute of the difference |
|
1239 |
+ * |
|
1240 |
+ * @return int |
|
1241 |
+ */ |
|
1242 |
+ public function diffInMonths($date = null, $absolute = true); |
|
1243 |
+ |
|
1244 |
+ /** |
|
1245 |
+ * Get the difference in hours using timestamps. |
|
1246 |
+ * |
|
1247 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1248 |
+ * @param bool $absolute Get the absolute of the difference |
|
1249 |
+ * |
|
1250 |
+ * @return int |
|
1251 |
+ */ |
|
1252 |
+ public function diffInRealHours($date = null, $absolute = true); |
|
1253 |
+ |
|
1254 |
+ /** |
|
1255 |
+ * Get the difference in microseconds using timestamps. |
|
1256 |
+ * |
|
1257 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1258 |
+ * @param bool $absolute Get the absolute of the difference |
|
1259 |
+ * |
|
1260 |
+ * @return int |
|
1261 |
+ */ |
|
1262 |
+ public function diffInRealMicroseconds($date = null, $absolute = true); |
|
1263 |
+ |
|
1264 |
+ /** |
|
1265 |
+ * Get the difference in milliseconds using timestamps. |
|
1266 |
+ * |
|
1267 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1268 |
+ * @param bool $absolute Get the absolute of the difference |
|
1269 |
+ * |
|
1270 |
+ * @return int |
|
1271 |
+ */ |
|
1272 |
+ public function diffInRealMilliseconds($date = null, $absolute = true); |
|
1273 |
+ |
|
1274 |
+ /** |
|
1275 |
+ * Get the difference in minutes using timestamps. |
|
1276 |
+ * |
|
1277 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1278 |
+ * @param bool $absolute Get the absolute of the difference |
|
1279 |
+ * |
|
1280 |
+ * @return int |
|
1281 |
+ */ |
|
1282 |
+ public function diffInRealMinutes($date = null, $absolute = true); |
|
1283 |
+ |
|
1284 |
+ /** |
|
1285 |
+ * Get the difference in seconds using timestamps. |
|
1286 |
+ * |
|
1287 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1288 |
+ * @param bool $absolute Get the absolute of the difference |
|
1289 |
+ * |
|
1290 |
+ * @return int |
|
1291 |
+ */ |
|
1292 |
+ public function diffInRealSeconds($date = null, $absolute = true); |
|
1293 |
+ |
|
1294 |
+ /** |
|
1295 |
+ * Get the difference in seconds. |
|
1296 |
+ * |
|
1297 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1298 |
+ * @param bool $absolute Get the absolute of the difference |
|
1299 |
+ * |
|
1300 |
+ * @return int |
|
1301 |
+ */ |
|
1302 |
+ public function diffInSeconds($date = null, $absolute = true); |
|
1303 |
+ |
|
1304 |
+ /** |
|
1305 |
+ * Get the difference in weekdays |
|
1306 |
+ * |
|
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 diffInWeekdays($date = null, $absolute = true); |
|
1313 |
+ |
|
1314 |
+ /** |
|
1315 |
+ * Get the difference in weekend days using a filter |
|
1316 |
+ * |
|
1317 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1318 |
+ * @param bool $absolute Get the absolute of the difference |
|
1319 |
+ * |
|
1320 |
+ * @return int |
|
1321 |
+ */ |
|
1322 |
+ public function diffInWeekendDays($date = null, $absolute = true); |
|
1323 |
+ |
|
1324 |
+ /** |
|
1325 |
+ * Get the difference in weeks |
|
1326 |
+ * |
|
1327 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1328 |
+ * @param bool $absolute Get the absolute of the difference |
|
1329 |
+ * |
|
1330 |
+ * @return int |
|
1331 |
+ */ |
|
1332 |
+ public function diffInWeeks($date = null, $absolute = true); |
|
1333 |
+ |
|
1334 |
+ /** |
|
1335 |
+ * Get the difference in years |
|
1336 |
+ * |
|
1337 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1338 |
+ * @param bool $absolute Get the absolute of the difference |
|
1339 |
+ * |
|
1340 |
+ * @return int |
|
1341 |
+ */ |
|
1342 |
+ public function diffInYears($date = null, $absolute = true); |
|
1343 |
+ |
|
1344 |
+ /** |
|
1345 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
1346 |
+ * You should rather use the ->settings() method. |
|
1347 |
+ * @see settings |
|
1348 |
+ * |
|
1349 |
+ * @param int $humanDiffOption |
|
1350 |
+ */ |
|
1351 |
+ public static function disableHumanDiffOption($humanDiffOption); |
|
1352 |
+ |
|
1353 |
+ /** |
|
1354 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
1355 |
+ * You should rather use the ->settings() method. |
|
1356 |
+ * @see settings |
|
1357 |
+ * |
|
1358 |
+ * @param int $humanDiffOption |
|
1359 |
+ */ |
|
1360 |
+ public static function enableHumanDiffOption($humanDiffOption); |
|
1361 |
+ |
|
1362 |
+ /** |
|
1363 |
+ * Modify to end of current given unit. |
|
1364 |
+ * |
|
1365 |
+ * @example |
|
1366 |
+ * ``` |
|
1367 |
+ * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
1368 |
+ * ->startOf('month') |
|
1369 |
+ * ->endOf('week', Carbon::FRIDAY); |
|
1370 |
+ * ``` |
|
1371 |
+ * |
|
1372 |
+ * @param string $unit |
|
1373 |
+ * @param array<int, mixed> $params |
|
1374 |
+ * |
|
1375 |
+ * @return static |
|
1376 |
+ */ |
|
1377 |
+ public function endOf($unit, ...$params); |
|
1378 |
+ |
|
1379 |
+ /** |
|
1380 |
+ * Resets the date to end of the century and time to 23:59:59.999999 |
|
1381 |
+ * |
|
1382 |
+ * @example |
|
1383 |
+ * ``` |
|
1384 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury(); |
|
1385 |
+ * ``` |
|
1386 |
+ * |
|
1387 |
+ * @return static |
|
1388 |
+ */ |
|
1389 |
+ public function endOfCentury(); |
|
1390 |
+ |
|
1391 |
+ /** |
|
1392 |
+ * Resets the time to 23:59:59.999999 end of day |
|
1393 |
+ * |
|
1394 |
+ * @example |
|
1395 |
+ * ``` |
|
1396 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfDay(); |
|
1397 |
+ * ``` |
|
1398 |
+ * |
|
1399 |
+ * @return static |
|
1400 |
+ */ |
|
1401 |
+ public function endOfDay(); |
|
1402 |
+ |
|
1403 |
+ /** |
|
1404 |
+ * Resets the date to end of the decade and time to 23:59:59.999999 |
|
1405 |
+ * |
|
1406 |
+ * @example |
|
1407 |
+ * ``` |
|
1408 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade(); |
|
1409 |
+ * ``` |
|
1410 |
+ * |
|
1411 |
+ * @return static |
|
1412 |
+ */ |
|
1413 |
+ public function endOfDecade(); |
|
1414 |
+ |
|
1415 |
+ /** |
|
1416 |
+ * Modify to end of current hour, minutes and seconds become 59 |
|
1417 |
+ * |
|
1418 |
+ * @example |
|
1419 |
+ * ``` |
|
1420 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfHour(); |
|
1421 |
+ * ``` |
|
1422 |
+ * |
|
1423 |
+ * @return static |
|
1424 |
+ */ |
|
1425 |
+ public function endOfHour(); |
|
1426 |
+ |
|
1427 |
+ /** |
|
1428 |
+ * Resets the date to end of the century and time to 23:59:59.999999 |
|
1429 |
+ * |
|
1430 |
+ * @example |
|
1431 |
+ * ``` |
|
1432 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium(); |
|
1433 |
+ * ``` |
|
1434 |
+ * |
|
1435 |
+ * @return static |
|
1436 |
+ */ |
|
1437 |
+ public function endOfMillennium(); |
|
1438 |
+ |
|
1439 |
+ /** |
|
1440 |
+ * Modify to end of current minute, seconds become 59 |
|
1441 |
+ * |
|
1442 |
+ * @example |
|
1443 |
+ * ``` |
|
1444 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute(); |
|
1445 |
+ * ``` |
|
1446 |
+ * |
|
1447 |
+ * @return static |
|
1448 |
+ */ |
|
1449 |
+ public function endOfMinute(); |
|
1450 |
+ |
|
1451 |
+ /** |
|
1452 |
+ * Resets the date to end of the month and time to 23:59:59.999999 |
|
1453 |
+ * |
|
1454 |
+ * @example |
|
1455 |
+ * ``` |
|
1456 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth(); |
|
1457 |
+ * ``` |
|
1458 |
+ * |
|
1459 |
+ * @return static |
|
1460 |
+ */ |
|
1461 |
+ public function endOfMonth(); |
|
1462 |
+ |
|
1463 |
+ /** |
|
1464 |
+ * Resets the date to end of the quarter and time to 23:59:59.999999 |
|
1465 |
+ * |
|
1466 |
+ * @example |
|
1467 |
+ * ``` |
|
1468 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter(); |
|
1469 |
+ * ``` |
|
1470 |
+ * |
|
1471 |
+ * @return static |
|
1472 |
+ */ |
|
1473 |
+ public function endOfQuarter(); |
|
1474 |
+ |
|
1475 |
+ /** |
|
1476 |
+ * Modify to end of current second, microseconds become 999999 |
|
1477 |
+ * |
|
1478 |
+ * @example |
|
1479 |
+ * ``` |
|
1480 |
+ * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
1481 |
+ * ->endOfSecond() |
|
1482 |
+ * ->format('H:i:s.u'); |
|
1483 |
+ * ``` |
|
1484 |
+ * |
|
1485 |
+ * @return static |
|
1486 |
+ */ |
|
1487 |
+ public function endOfSecond(); |
|
1488 |
+ |
|
1489 |
+ /** |
|
1490 |
+ * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999 |
|
1491 |
+ * |
|
1492 |
+ * @example |
|
1493 |
+ * ``` |
|
1494 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n"; |
|
1495 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n"; |
|
1496 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n"; |
|
1497 |
+ * ``` |
|
1498 |
+ * |
|
1499 |
+ * @param int $weekEndsAt optional start allow you to specify the day of week to use to end the week |
|
1500 |
+ * |
|
1501 |
+ * @return static |
|
1502 |
+ */ |
|
1503 |
+ public function endOfWeek($weekEndsAt = null); |
|
1504 |
+ |
|
1505 |
+ /** |
|
1506 |
+ * Resets the date to end of the year and time to 23:59:59.999999 |
|
1507 |
+ * |
|
1508 |
+ * @example |
|
1509 |
+ * ``` |
|
1510 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->endOfYear(); |
|
1511 |
+ * ``` |
|
1512 |
+ * |
|
1513 |
+ * @return static |
|
1514 |
+ */ |
|
1515 |
+ public function endOfYear(); |
|
1516 |
+ |
|
1517 |
+ /** |
|
1518 |
+ * Determines if the instance is equal to another |
|
1519 |
+ * |
|
1520 |
+ * @example |
|
1521 |
+ * ``` |
|
1522 |
+ * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true |
|
1523 |
+ * Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true |
|
1524 |
+ * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false |
|
1525 |
+ * ``` |
|
1526 |
+ * |
|
1527 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
1528 |
+ * |
|
1529 |
+ * @see equalTo() |
|
1530 |
+ * |
|
1531 |
+ * @return bool |
|
1532 |
+ */ |
|
1533 |
+ public function eq($date): bool; |
|
1534 |
+ |
|
1535 |
+ /** |
|
1536 |
+ * Determines if the instance is equal to another |
|
1537 |
+ * |
|
1538 |
+ * @example |
|
1539 |
+ * ``` |
|
1540 |
+ * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true |
|
1541 |
+ * Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true |
|
1542 |
+ * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false |
|
1543 |
+ * ``` |
|
1544 |
+ * |
|
1545 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
1546 |
+ * |
|
1547 |
+ * @return bool |
|
1548 |
+ */ |
|
1549 |
+ public function equalTo($date): bool; |
|
1550 |
+ |
|
1551 |
+ /** |
|
1552 |
+ * Set the current locale to the given, execute the passed function, reset the locale to previous one, |
|
1553 |
+ * then return the result of the closure (or null if the closure was void). |
|
1554 |
+ * |
|
1555 |
+ * @param string $locale locale ex. en |
|
1556 |
+ * @param callable $func |
|
1557 |
+ * |
|
1558 |
+ * @return mixed |
|
1559 |
+ */ |
|
1560 |
+ public static function executeWithLocale($locale, $func); |
|
1561 |
+ |
|
1562 |
+ /** |
|
1563 |
+ * Get the farthest date from the instance (second-precision). |
|
1564 |
+ * |
|
1565 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
1566 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
1567 |
+ * |
|
1568 |
+ * @return static |
|
1569 |
+ */ |
|
1570 |
+ public function farthest($date1, $date2); |
|
1571 |
+ |
|
1572 |
+ /** |
|
1573 |
+ * Modify to the first occurrence of a given day of the week |
|
1574 |
+ * in the current month. If no dayOfWeek is provided, modify to the |
|
1575 |
+ * first day of the current month. Use the supplied constants |
|
1576 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1577 |
+ * |
|
1578 |
+ * @param int|null $dayOfWeek |
|
1579 |
+ * |
|
1580 |
+ * @return static |
|
1581 |
+ */ |
|
1582 |
+ public function firstOfMonth($dayOfWeek = null); |
|
1583 |
+ |
|
1584 |
+ /** |
|
1585 |
+ * Modify to the first occurrence of a given day of the week |
|
1586 |
+ * in the current quarter. If no dayOfWeek is provided, modify to the |
|
1587 |
+ * first day of the current quarter. Use the supplied constants |
|
1588 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1589 |
+ * |
|
1590 |
+ * @param int|null $dayOfWeek day of the week default null |
|
1591 |
+ * |
|
1592 |
+ * @return static |
|
1593 |
+ */ |
|
1594 |
+ public function firstOfQuarter($dayOfWeek = null); |
|
1595 |
+ |
|
1596 |
+ /** |
|
1597 |
+ * Modify to the first occurrence of a given day of the week |
|
1598 |
+ * in the current year. If no dayOfWeek is provided, modify to the |
|
1599 |
+ * first day of the current year. Use the supplied constants |
|
1600 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
1601 |
+ * |
|
1602 |
+ * @param int|null $dayOfWeek day of the week default null |
|
1603 |
+ * |
|
1604 |
+ * @return static |
|
1605 |
+ */ |
|
1606 |
+ public function firstOfYear($dayOfWeek = null); |
|
1607 |
+ |
|
1608 |
+ /** |
|
1609 |
+ * Get the difference in days as float (microsecond-precision). |
|
1610 |
+ * |
|
1611 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1612 |
+ * @param bool $absolute Get the absolute of the difference |
|
1613 |
+ * |
|
1614 |
+ * @return float |
|
1615 |
+ */ |
|
1616 |
+ public function floatDiffInDays($date = null, $absolute = true); |
|
1617 |
+ |
|
1618 |
+ /** |
|
1619 |
+ * Get the difference in hours as float (microsecond-precision). |
|
1620 |
+ * |
|
1621 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1622 |
+ * @param bool $absolute Get the absolute of the difference |
|
1623 |
+ * |
|
1624 |
+ * @return float |
|
1625 |
+ */ |
|
1626 |
+ public function floatDiffInHours($date = null, $absolute = true); |
|
1627 |
+ |
|
1628 |
+ /** |
|
1629 |
+ * Get the difference in minutes as float (microsecond-precision). |
|
1630 |
+ * |
|
1631 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1632 |
+ * @param bool $absolute Get the absolute of the difference |
|
1633 |
+ * |
|
1634 |
+ * @return float |
|
1635 |
+ */ |
|
1636 |
+ public function floatDiffInMinutes($date = null, $absolute = true); |
|
1637 |
+ |
|
1638 |
+ /** |
|
1639 |
+ * Get the difference in months as float (microsecond-precision). |
|
1640 |
+ * |
|
1641 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1642 |
+ * @param bool $absolute Get the absolute of the difference |
|
1643 |
+ * |
|
1644 |
+ * @return float |
|
1645 |
+ */ |
|
1646 |
+ public function floatDiffInMonths($date = null, $absolute = true); |
|
1647 |
+ |
|
1648 |
+ /** |
|
1649 |
+ * Get the difference in days as float (microsecond-precision). |
|
1650 |
+ * |
|
1651 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1652 |
+ * @param bool $absolute Get the absolute of the difference |
|
1653 |
+ * |
|
1654 |
+ * @return float |
|
1655 |
+ */ |
|
1656 |
+ public function floatDiffInRealDays($date = null, $absolute = true); |
|
1657 |
+ |
|
1658 |
+ /** |
|
1659 |
+ * Get the difference in hours as float (microsecond-precision) using timestamps. |
|
1660 |
+ * |
|
1661 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1662 |
+ * @param bool $absolute Get the absolute of the difference |
|
1663 |
+ * |
|
1664 |
+ * @return float |
|
1665 |
+ */ |
|
1666 |
+ public function floatDiffInRealHours($date = null, $absolute = true); |
|
1667 |
+ |
|
1668 |
+ /** |
|
1669 |
+ * Get the difference in minutes as float (microsecond-precision) using timestamps. |
|
1670 |
+ * |
|
1671 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1672 |
+ * @param bool $absolute Get the absolute of the difference |
|
1673 |
+ * |
|
1674 |
+ * @return float |
|
1675 |
+ */ |
|
1676 |
+ public function floatDiffInRealMinutes($date = null, $absolute = true); |
|
1677 |
+ |
|
1678 |
+ /** |
|
1679 |
+ * Get the difference in months as float (microsecond-precision) using timestamps. |
|
1680 |
+ * |
|
1681 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1682 |
+ * @param bool $absolute Get the absolute of the difference |
|
1683 |
+ * |
|
1684 |
+ * @return float |
|
1685 |
+ */ |
|
1686 |
+ public function floatDiffInRealMonths($date = null, $absolute = true); |
|
1687 |
+ |
|
1688 |
+ /** |
|
1689 |
+ * Get the difference in seconds as float (microsecond-precision) using timestamps. |
|
1690 |
+ * |
|
1691 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1692 |
+ * @param bool $absolute Get the absolute of the difference |
|
1693 |
+ * |
|
1694 |
+ * @return float |
|
1695 |
+ */ |
|
1696 |
+ public function floatDiffInRealSeconds($date = null, $absolute = true); |
|
1697 |
+ |
|
1698 |
+ /** |
|
1699 |
+ * Get the difference in year as float (microsecond-precision) using timestamps. |
|
1700 |
+ * |
|
1701 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1702 |
+ * @param bool $absolute Get the absolute of the difference |
|
1703 |
+ * |
|
1704 |
+ * @return float |
|
1705 |
+ */ |
|
1706 |
+ public function floatDiffInRealYears($date = null, $absolute = true); |
|
1707 |
+ |
|
1708 |
+ /** |
|
1709 |
+ * Get the difference in seconds as float (microsecond-precision). |
|
1710 |
+ * |
|
1711 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1712 |
+ * @param bool $absolute Get the absolute of the difference |
|
1713 |
+ * |
|
1714 |
+ * @return float |
|
1715 |
+ */ |
|
1716 |
+ public function floatDiffInSeconds($date = null, $absolute = true); |
|
1717 |
+ |
|
1718 |
+ /** |
|
1719 |
+ * Get the difference in year as float (microsecond-precision). |
|
1720 |
+ * |
|
1721 |
+ * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date |
|
1722 |
+ * @param bool $absolute Get the absolute of the difference |
|
1723 |
+ * |
|
1724 |
+ * @return float |
|
1725 |
+ */ |
|
1726 |
+ public function floatDiffInYears($date = null, $absolute = true); |
|
1727 |
+ |
|
1728 |
+ /** |
|
1729 |
+ * Round the current instance second with given precision if specified. |
|
1730 |
+ * |
|
1731 |
+ * @param float|int $precision |
|
1732 |
+ * |
|
1733 |
+ * @return CarbonInterface |
|
1734 |
+ */ |
|
1735 |
+ public function floor($precision = 1); |
|
1736 |
+ |
|
1737 |
+ /** |
|
1738 |
+ * Truncate the current instance at the given unit with given precision if specified. |
|
1739 |
+ * |
|
1740 |
+ * @param string $unit |
|
1741 |
+ * @param float|int $precision |
|
1742 |
+ * |
|
1743 |
+ * @return CarbonInterface |
|
1744 |
+ */ |
|
1745 |
+ public function floorUnit($unit, $precision = 1); |
|
1746 |
+ |
|
1747 |
+ /** |
|
1748 |
+ * Truncate the current instance week. |
|
1749 |
+ * |
|
1750 |
+ * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
1751 |
+ * |
|
1752 |
+ * @return CarbonInterface |
|
1753 |
+ */ |
|
1754 |
+ public function floorWeek($weekStartsAt = null); |
|
1755 |
+ |
|
1756 |
+ /** |
|
1757 |
+ * Format the instance with the current locale. You can set the current |
|
1758 |
+ * locale using setlocale() http://php.net/setlocale. |
|
1759 |
+ * |
|
1760 |
+ * @param string $format |
|
1761 |
+ * |
|
1762 |
+ * @return string |
|
1763 |
+ */ |
|
1764 |
+ public function formatLocalized($format); |
|
1765 |
+ |
|
1766 |
+ /** |
|
1767 |
+ * @alias diffForHumans |
|
1768 |
+ * |
|
1769 |
+ * Get the difference in a human readable format in the current locale from current instance to an other |
|
1770 |
+ * instance given (or now if null given). |
|
1771 |
+ * |
|
1772 |
+ * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
1773 |
+ * if null passed, now will be used as comparison reference; |
|
1774 |
+ * if any other type, it will be converted to date and used as reference. |
|
1775 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1776 |
+ * - 'syntax' entry (see below) |
|
1777 |
+ * - 'short' entry (see below) |
|
1778 |
+ * - 'parts' entry (see below) |
|
1779 |
+ * - 'options' entry (see below) |
|
1780 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
1781 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
1782 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1783 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1784 |
+ * ` will be used instead of the glue for the last item |
|
1785 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1786 |
+ * ` - if $join is missing, a space will be used as glue |
|
1787 |
+ * - 'other' entry (see above) |
|
1788 |
+ * if int passed, it add modifiers: |
|
1789 |
+ * Possible values: |
|
1790 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1791 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1792 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1793 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1794 |
+ * @param bool $short displays short format of time units |
|
1795 |
+ * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1796 |
+ * @param int $options human diff options |
|
1797 |
+ * |
|
1798 |
+ * @return string |
|
1799 |
+ */ |
|
1800 |
+ public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
1801 |
+ |
|
1802 |
+ /** |
|
1803 |
+ * Get the difference in a human readable format in the current locale from current |
|
1804 |
+ * instance to now. |
|
1805 |
+ * |
|
1806 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
1807 |
+ * - 'syntax' entry (see below) |
|
1808 |
+ * - 'short' entry (see below) |
|
1809 |
+ * - 'parts' entry (see below) |
|
1810 |
+ * - 'options' entry (see below) |
|
1811 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
1812 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
1813 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
1814 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
1815 |
+ * ` will be used instead of the glue for the last item |
|
1816 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
1817 |
+ * ` - if $join is missing, a space will be used as glue |
|
1818 |
+ * if int passed, it add modifiers: |
|
1819 |
+ * Possible values: |
|
1820 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
1821 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
1822 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
1823 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
1824 |
+ * @param bool $short displays short format of time units |
|
1825 |
+ * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
1826 |
+ * @param int $options human diff options |
|
1827 |
+ * |
|
1828 |
+ * @return string |
|
1829 |
+ */ |
|
1830 |
+ public function fromNow($syntax = null, $short = false, $parts = 1, $options = null); |
|
1831 |
+ |
|
1832 |
+ /** |
|
1833 |
+ * Create an instance from a serialized string. |
|
1834 |
+ * |
|
1835 |
+ * @param string $value |
|
1836 |
+ * |
|
1837 |
+ * @throws \InvalidArgumentException |
|
1838 |
+ * |
|
1839 |
+ * @return static |
|
1840 |
+ */ |
|
1841 |
+ public static function fromSerialized($value); |
|
1842 |
+ |
|
1843 |
+ /** |
|
1844 |
+ * Register a custom macro. |
|
1845 |
+ * |
|
1846 |
+ * @param object|callable $macro |
|
1847 |
+ * @param int $priority marco with higher priority is tried first |
|
1848 |
+ * |
|
1849 |
+ * @return void |
|
1850 |
+ */ |
|
1851 |
+ public static function genericMacro($macro, $priority = 0); |
|
1852 |
+ |
|
1853 |
+ /** |
|
1854 |
+ * Get a part of the Carbon object |
|
1855 |
+ * |
|
1856 |
+ * @param string $name |
|
1857 |
+ * |
|
1858 |
+ * @throws InvalidArgumentException|ReflectionException |
|
1859 |
+ * |
|
1860 |
+ * @return string|int|bool|\DateTimeZone|null |
|
1861 |
+ */ |
|
1862 |
+ public function get($name); |
|
1863 |
+ |
|
1864 |
+ /** |
|
1865 |
+ * Returns the alternative number if available in the current locale. |
|
1866 |
+ * |
|
1867 |
+ * @param string $key date property |
|
1868 |
+ * |
|
1869 |
+ * @return string |
|
1870 |
+ */ |
|
1871 |
+ public function getAltNumber(string $key): string; |
|
1872 |
+ |
|
1873 |
+ /** |
|
1874 |
+ * Returns the list of internally available locales and already loaded custom locales. |
|
1875 |
+ * (It will ignore custom translator dynamic loading.) |
|
1876 |
+ * |
|
1877 |
+ * @return array |
|
1878 |
+ */ |
|
1879 |
+ public static function getAvailableLocales(); |
|
1880 |
+ |
|
1881 |
+ /** |
|
1882 |
+ * Returns list of Language object for each available locale. This object allow you to get the ISO name, native |
|
1883 |
+ * name, region and variant of the locale. |
|
1884 |
+ * |
|
1885 |
+ * @return Language[] |
|
1886 |
+ */ |
|
1887 |
+ public static function getAvailableLocalesInfo(); |
|
1888 |
+ |
|
1889 |
+ /** |
|
1890 |
+ * Returns list of calendar formats for ISO formatting. |
|
1891 |
+ * |
|
1892 |
+ * @param string|null $locale current locale used if null |
|
1893 |
+ * |
|
1894 |
+ * @return array |
|
1895 |
+ */ |
|
1896 |
+ public function getCalendarFormats($locale = null); |
|
1897 |
+ |
|
1898 |
+ /** |
|
1899 |
+ * Get the days of the week |
|
1900 |
+ * |
|
1901 |
+ * @return array |
|
1902 |
+ */ |
|
1903 |
+ public static function getDays(); |
|
1904 |
+ |
|
1905 |
+ /** |
|
1906 |
+ * Get the fallback locale. |
|
1907 |
+ * |
|
1908 |
+ * @see https://symfony.com/doc/current/components/translation.html#fallback-locales |
|
1909 |
+ * |
|
1910 |
+ * @return string|null |
|
1911 |
+ */ |
|
1912 |
+ public static function getFallbackLocale(); |
|
1913 |
+ |
|
1914 |
+ /** |
|
1915 |
+ * List of replacements from date() format to isoFormat(). |
|
1916 |
+ * |
|
1917 |
+ * @return array |
|
1918 |
+ */ |
|
1919 |
+ public static function getFormatsToIsoReplacements(); |
|
1920 |
+ |
|
1921 |
+ /** |
|
1922 |
+ * Return default humanDiff() options (merged flags as integer). |
|
1923 |
+ * |
|
1924 |
+ * @return int |
|
1925 |
+ */ |
|
1926 |
+ public static function getHumanDiffOptions(); |
|
1927 |
+ |
|
1928 |
+ /** |
|
1929 |
+ * Returns list of locale formats for ISO formatting. |
|
1930 |
+ * |
|
1931 |
+ * @param string|null $locale current locale used if null |
|
1932 |
+ * |
|
1933 |
+ * @return array |
|
1934 |
+ */ |
|
1935 |
+ public function getIsoFormats($locale = null); |
|
1936 |
+ |
|
1937 |
+ /** |
|
1938 |
+ * Returns list of locale units for ISO formatting. |
|
1939 |
+ * |
|
1940 |
+ * @return array |
|
1941 |
+ */ |
|
1942 |
+ public static function getIsoUnits(); |
|
1943 |
+ |
|
1944 |
+ /** |
|
1945 |
+ * {@inheritdoc} |
|
1946 |
+ */ |
|
1947 |
+ public static function getLastErrors(); |
|
1948 |
+ |
|
1949 |
+ /** |
|
1950 |
+ * Get the translator of the current instance or the default if none set. |
|
1951 |
+ * |
|
1952 |
+ * @return \Symfony\Component\Translation\TranslatorInterface |
|
1953 |
+ */ |
|
1954 |
+ public function getLocalTranslator(); |
|
1955 |
+ |
|
1956 |
+ /** |
|
1957 |
+ * Get the current translator locale. |
|
1958 |
+ * |
|
1959 |
+ * @return string |
|
1960 |
+ */ |
|
1961 |
+ public static function getLocale(); |
|
1962 |
+ |
|
1963 |
+ /** |
|
1964 |
+ * get midday/noon hour |
|
1965 |
+ * |
|
1966 |
+ * @return int |
|
1967 |
+ */ |
|
1968 |
+ public static function getMidDayAt(); |
|
1969 |
+ |
|
1970 |
+ /** |
|
1971 |
+ * Returns the offset hour and minute formatted with +/- and a given separator (":" by default). |
|
1972 |
+ * For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first |
|
1973 |
+ * argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something |
|
1974 |
+ * like "-12:00". |
|
1975 |
+ * |
|
1976 |
+ * @param string $separator string to place between hours and minutes (":" by default) |
|
1977 |
+ * |
|
1978 |
+ * @return string |
|
1979 |
+ */ |
|
1980 |
+ public function getOffsetString($separator = ':'); |
|
1981 |
+ |
|
1982 |
+ /** |
|
1983 |
+ * Returns a unit of the instance padded with 0 by default or any other string if specified. |
|
1984 |
+ * |
|
1985 |
+ * @param string $unit Carbon unit name |
|
1986 |
+ * @param int $length Length of the output (2 by default) |
|
1987 |
+ * @param string $padString String to use for padding ("0" by default) |
|
1988 |
+ * @param int $padType Side(s) to pad (STR_PAD_LEFT by default) |
|
1989 |
+ * |
|
1990 |
+ * @return string |
|
1991 |
+ */ |
|
1992 |
+ public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = 0); |
|
1993 |
+ |
|
1994 |
+ /** |
|
1995 |
+ * Returns a timestamp rounded with the given precision (6 by default). |
|
1996 |
+ * |
|
1997 |
+ * @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision) |
|
1998 |
+ * @example getPreciseTimestamp(6) 1532087464437474 |
|
1999 |
+ * @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision) |
|
2000 |
+ * @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision) |
|
2001 |
+ * @example getPreciseTimestamp(3) 1532087464437 (millisecond precision) |
|
2002 |
+ * @example getPreciseTimestamp(2) 153208746444 (1/100 second precision) |
|
2003 |
+ * @example getPreciseTimestamp(1) 15320874644 (1/10 second precision) |
|
2004 |
+ * @example getPreciseTimestamp(0) 1532087464 (second precision) |
|
2005 |
+ * @example getPreciseTimestamp(-1) 153208746 (10 second precision) |
|
2006 |
+ * @example getPreciseTimestamp(-2) 15320875 (100 second precision) |
|
2007 |
+ * |
|
2008 |
+ * @param int $precision |
|
2009 |
+ * |
|
2010 |
+ * @return float |
|
2011 |
+ */ |
|
2012 |
+ public function getPreciseTimestamp($precision = 6); |
|
2013 |
+ |
|
2014 |
+ /** |
|
2015 |
+ * Returns current local settings. |
|
2016 |
+ * |
|
2017 |
+ * @return array |
|
2018 |
+ */ |
|
2019 |
+ public function getSettings(); |
|
2020 |
+ |
|
2021 |
+ /** |
|
2022 |
+ * Get the Carbon instance (real or mock) to be returned when a "now" |
|
2023 |
+ * instance is created. |
|
2024 |
+ * |
|
2025 |
+ * @return static the current instance used for testing |
|
2026 |
+ */ |
|
2027 |
+ public static function getTestNow(); |
|
2028 |
+ |
|
2029 |
+ /** |
|
2030 |
+ * Get the translation of the current week day name (with context for languages with multiple forms). |
|
2031 |
+ * |
|
2032 |
+ * @param string|null $context whole format string |
|
2033 |
+ * @param string $keySuffix "", "_short" or "_min" |
|
2034 |
+ * @param string|null $defaultValue default value if translation missing |
|
2035 |
+ * |
|
2036 |
+ * @return string |
|
2037 |
+ */ |
|
2038 |
+ public function getTranslatedDayName($context = null, $keySuffix = '', $defaultValue = null); |
|
2039 |
+ |
|
2040 |
+ /** |
|
2041 |
+ * Get the translation of the current abbreviated week day name (with context for languages with multiple forms). |
|
2042 |
+ * |
|
2043 |
+ * @param string|null $context whole format string |
|
2044 |
+ * |
|
2045 |
+ * @return string |
|
2046 |
+ */ |
|
2047 |
+ public function getTranslatedMinDayName($context = null); |
|
2048 |
+ |
|
2049 |
+ /** |
|
2050 |
+ * Get the translation of the current month day name (with context for languages with multiple forms). |
|
2051 |
+ * |
|
2052 |
+ * @param string|null $context whole format string |
|
2053 |
+ * @param string $keySuffix "" or "_short" |
|
2054 |
+ * @param string|null $defaultValue default value if translation missing |
|
2055 |
+ * |
|
2056 |
+ * @return string |
|
2057 |
+ */ |
|
2058 |
+ public function getTranslatedMonthName($context = null, $keySuffix = '', $defaultValue = null); |
|
2059 |
+ |
|
2060 |
+ /** |
|
2061 |
+ * Get the translation of the current short week day name (with context for languages with multiple forms). |
|
2062 |
+ * |
|
2063 |
+ * @param string|null $context whole format string |
|
2064 |
+ * |
|
2065 |
+ * @return string |
|
2066 |
+ */ |
|
2067 |
+ public function getTranslatedShortDayName($context = null); |
|
2068 |
+ |
|
2069 |
+ /** |
|
2070 |
+ * Get the translation of the current short month day name (with context for languages with multiple forms). |
|
2071 |
+ * |
|
2072 |
+ * @param string|null $context whole format string |
|
2073 |
+ * |
|
2074 |
+ * @return string |
|
2075 |
+ */ |
|
2076 |
+ public function getTranslatedShortMonthName($context = null); |
|
2077 |
+ |
|
2078 |
+ /** |
|
2079 |
+ * Returns raw translation message for a given key. |
|
2080 |
+ * |
|
2081 |
+ * @param string $key key to find |
|
2082 |
+ * @param string|null $locale current locale used if null |
|
2083 |
+ * @param string|null $default default value if translation returns the key |
|
2084 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator an optional translator to use |
|
2085 |
+ * |
|
2086 |
+ * @return string |
|
2087 |
+ */ |
|
2088 |
+ public function getTranslationMessage(string $key, string $locale = null, string $default = null, $translator = null); |
|
2089 |
+ |
|
2090 |
+ /** |
|
2091 |
+ * Returns raw translation message for a given key. |
|
2092 |
+ * |
|
2093 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator the translator to use |
|
2094 |
+ * @param string $key key to find |
|
2095 |
+ * @param string|null $locale current locale used if null |
|
2096 |
+ * @param string|null $default default value if translation returns the key |
|
2097 |
+ * |
|
2098 |
+ * @return string |
|
2099 |
+ */ |
|
2100 |
+ public static function getTranslationMessageWith($translator, string $key, string $locale = null, string $default = null); |
|
2101 |
+ |
|
2102 |
+ /** |
|
2103 |
+ * Get the default translator instance in use. |
|
2104 |
+ * |
|
2105 |
+ * @return \Symfony\Component\Translation\TranslatorInterface |
|
2106 |
+ */ |
|
2107 |
+ public static function getTranslator(); |
|
2108 |
+ |
|
2109 |
+ /** |
|
2110 |
+ * Get the last day of week |
|
2111 |
+ * |
|
2112 |
+ * @return int |
|
2113 |
+ */ |
|
2114 |
+ public static function getWeekEndsAt(); |
|
2115 |
+ |
|
2116 |
+ /** |
|
2117 |
+ * Get the first day of week |
|
2118 |
+ * |
|
2119 |
+ * @return int |
|
2120 |
+ */ |
|
2121 |
+ public static function getWeekStartsAt(); |
|
2122 |
+ |
|
2123 |
+ /** |
|
2124 |
+ * Get weekend days |
|
2125 |
+ * |
|
2126 |
+ * @return array |
|
2127 |
+ */ |
|
2128 |
+ public static function getWeekendDays(); |
|
2129 |
+ |
|
2130 |
+ /** |
|
2131 |
+ * Determines if the instance is greater (after) than another |
|
2132 |
+ * |
|
2133 |
+ * @example |
|
2134 |
+ * ``` |
|
2135 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false |
|
2136 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:18'); // true |
|
2137 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false |
|
2138 |
+ * ``` |
|
2139 |
+ * |
|
2140 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2141 |
+ * |
|
2142 |
+ * @return bool |
|
2143 |
+ */ |
|
2144 |
+ public function greaterThan($date): bool; |
|
2145 |
+ |
|
2146 |
+ /** |
|
2147 |
+ * Determines if the instance is greater (after) than or equal to another |
|
2148 |
+ * |
|
2149 |
+ * @example |
|
2150 |
+ * ``` |
|
2151 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true |
|
2152 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:18'); // true |
|
2153 |
+ * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false |
|
2154 |
+ * ``` |
|
2155 |
+ * |
|
2156 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2157 |
+ * |
|
2158 |
+ * @return bool |
|
2159 |
+ */ |
|
2160 |
+ public function greaterThanOrEqualTo($date): bool; |
|
2161 |
+ |
|
2162 |
+ /** |
|
2163 |
+ * Determines if the instance is greater (after) than another |
|
2164 |
+ * |
|
2165 |
+ * @example |
|
2166 |
+ * ``` |
|
2167 |
+ * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false |
|
2168 |
+ * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:18'); // true |
|
2169 |
+ * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false |
|
2170 |
+ * ``` |
|
2171 |
+ * |
|
2172 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2173 |
+ * |
|
2174 |
+ * @see greaterThan() |
|
2175 |
+ * |
|
2176 |
+ * @return bool |
|
2177 |
+ */ |
|
2178 |
+ public function gt($date): bool; |
|
2179 |
+ |
|
2180 |
+ /** |
|
2181 |
+ * Determines if the instance is greater (after) than or equal to another |
|
2182 |
+ * |
|
2183 |
+ * @example |
|
2184 |
+ * ``` |
|
2185 |
+ * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true |
|
2186 |
+ * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:18'); // true |
|
2187 |
+ * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false |
|
2188 |
+ * ``` |
|
2189 |
+ * |
|
2190 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2191 |
+ * |
|
2192 |
+ * @see greaterThanOrEqualTo() |
|
2193 |
+ * |
|
2194 |
+ * @return bool |
|
2195 |
+ */ |
|
2196 |
+ public function gte($date): bool; |
|
2197 |
+ |
|
2198 |
+ /** |
|
2199 |
+ * Checks if the (date)time string is in a given format. |
|
2200 |
+ * |
|
2201 |
+ * @example |
|
2202 |
+ * ``` |
|
2203 |
+ * Carbon::hasFormat('11:12:45', 'h:i:s'); // true |
|
2204 |
+ * Carbon::hasFormat('13:12:45', 'h:i:s'); // false |
|
2205 |
+ * ``` |
|
2206 |
+ * |
|
2207 |
+ * @SuppressWarnings(PHPMD.EmptyCatchBlock) |
|
2208 |
+ * |
|
2209 |
+ * @param string $date |
|
2210 |
+ * @param string $format |
|
2211 |
+ * |
|
2212 |
+ * @return bool |
|
2213 |
+ */ |
|
2214 |
+ public static function hasFormat($date, $format); |
|
2215 |
+ |
|
2216 |
+ /** |
|
2217 |
+ * Checks if macro is registered. |
|
2218 |
+ * |
|
2219 |
+ * @param string $name |
|
2220 |
+ * |
|
2221 |
+ * @return bool |
|
2222 |
+ */ |
|
2223 |
+ public static function hasMacro($name); |
|
2224 |
+ |
|
2225 |
+ /** |
|
2226 |
+ * Determine if a time string will produce a relative date. |
|
2227 |
+ * |
|
2228 |
+ * @param string $time |
|
2229 |
+ * |
|
2230 |
+ * @return bool true if time match a relative date, false if absolute or invalid time string |
|
2231 |
+ */ |
|
2232 |
+ public static function hasRelativeKeywords($time); |
|
2233 |
+ |
|
2234 |
+ /** |
|
2235 |
+ * Determine if there is a valid test instance set. A valid test instance |
|
2236 |
+ * is anything that is not null. |
|
2237 |
+ * |
|
2238 |
+ * @return bool true if there is a test instance, otherwise false |
|
2239 |
+ */ |
|
2240 |
+ public static function hasTestNow(); |
|
2241 |
+ |
|
2242 |
+ /** |
|
2243 |
+ * Create a Carbon instance from a DateTime one. |
|
2244 |
+ * |
|
2245 |
+ * @param \DateTimeInterface $date |
|
2246 |
+ * |
|
2247 |
+ * @return static |
|
2248 |
+ */ |
|
2249 |
+ public static function instance($date); |
|
2250 |
+ |
|
2251 |
+ /** |
|
2252 |
+ * Returns true if the current date matches the given string. |
|
2253 |
+ * |
|
2254 |
+ * @example |
|
2255 |
+ * ``` |
|
2256 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true |
|
2257 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false |
|
2258 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true |
|
2259 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true |
|
2260 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true |
|
2261 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true |
|
2262 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true |
|
2263 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true |
|
2264 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true |
|
2265 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false |
|
2266 |
+ * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true |
|
2267 |
+ * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true |
|
2268 |
+ * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false |
|
2269 |
+ * ``` |
|
2270 |
+ * |
|
2271 |
+ * @param string $tester day name, month name, hour, date, etc. as string |
|
2272 |
+ * |
|
2273 |
+ * @return bool |
|
2274 |
+ */ |
|
2275 |
+ public function is(string $tester); |
|
2276 |
+ |
|
2277 |
+ /** |
|
2278 |
+ * Determines if the instance is greater (after) than another |
|
2279 |
+ * |
|
2280 |
+ * @example |
|
2281 |
+ * ``` |
|
2282 |
+ * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false |
|
2283 |
+ * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:18'); // true |
|
2284 |
+ * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false |
|
2285 |
+ * ``` |
|
2286 |
+ * |
|
2287 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2288 |
+ * |
|
2289 |
+ * @see greaterThan() |
|
2290 |
+ * |
|
2291 |
+ * @return bool |
|
2292 |
+ */ |
|
2293 |
+ public function isAfter($date): bool; |
|
2294 |
+ |
|
2295 |
+ /** |
|
2296 |
+ * Determines if the instance is less (before) than another |
|
2297 |
+ * |
|
2298 |
+ * @example |
|
2299 |
+ * ``` |
|
2300 |
+ * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false |
|
2301 |
+ * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:18'); // false |
|
2302 |
+ * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true |
|
2303 |
+ * ``` |
|
2304 |
+ * |
|
2305 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2306 |
+ * |
|
2307 |
+ * @see lessThan() |
|
2308 |
+ * |
|
2309 |
+ * @return bool |
|
2310 |
+ */ |
|
2311 |
+ public function isBefore($date): bool; |
|
2312 |
+ |
|
2313 |
+ /** |
|
2314 |
+ * Determines if the instance is between two others |
|
2315 |
+ * |
|
2316 |
+ * @example |
|
2317 |
+ * ``` |
|
2318 |
+ * Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true |
|
2319 |
+ * Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false |
|
2320 |
+ * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // false |
|
2321 |
+ * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', true); // true |
|
2322 |
+ * ``` |
|
2323 |
+ * |
|
2324 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 |
|
2325 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 |
|
2326 |
+ * @param bool $equal Indicates if an equal to comparison should be done |
|
2327 |
+ * |
|
2328 |
+ * @return bool |
|
2329 |
+ */ |
|
2330 |
+ public function isBetween($date1, $date2, $equal = true): bool; |
|
2331 |
+ |
|
2332 |
+ /** |
|
2333 |
+ * Check if its the birthday. Compares the date/month values of the two dates. |
|
2334 |
+ * |
|
2335 |
+ * @example |
|
2336 |
+ * ``` |
|
2337 |
+ * Carbon::now()->subYears(5)->isBirthday(); // true |
|
2338 |
+ * Carbon::now()->subYears(5)->subDay()->isBirthday(); // false |
|
2339 |
+ * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true |
|
2340 |
+ * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false |
|
2341 |
+ * ``` |
|
2342 |
+ * |
|
2343 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. |
|
2344 |
+ * |
|
2345 |
+ * @return bool |
|
2346 |
+ */ |
|
2347 |
+ public function isBirthday($date = null); |
|
2348 |
+ |
|
2349 |
+ /** |
|
2350 |
+ * Determines if the instance is in the current unit given. |
|
2351 |
+ * |
|
2352 |
+ * @example |
|
2353 |
+ * ``` |
|
2354 |
+ * Carbon::now()->isCurrentUnit('hour'); // true |
|
2355 |
+ * Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false |
|
2356 |
+ * ``` |
|
2357 |
+ * |
|
2358 |
+ * @param string $unit The unit to test. |
|
2359 |
+ * |
|
2360 |
+ * @throws \BadMethodCallException |
|
2361 |
+ * |
|
2362 |
+ * @return bool |
|
2363 |
+ */ |
|
2364 |
+ public function isCurrentUnit($unit); |
|
2365 |
+ |
|
2366 |
+ /** |
|
2367 |
+ * Checks if this day is a specific day of the week. |
|
2368 |
+ * |
|
2369 |
+ * @example |
|
2370 |
+ * ``` |
|
2371 |
+ * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true |
|
2372 |
+ * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false |
|
2373 |
+ * Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true |
|
2374 |
+ * Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false |
|
2375 |
+ * ``` |
|
2376 |
+ * |
|
2377 |
+ * @param int $dayOfWeek |
|
2378 |
+ * |
|
2379 |
+ * @return bool |
|
2380 |
+ */ |
|
2381 |
+ public function isDayOfWeek($dayOfWeek); |
|
2382 |
+ |
|
2383 |
+ /** |
|
2384 |
+ * Check if the instance is end of day. |
|
2385 |
+ * |
|
2386 |
+ * @example |
|
2387 |
+ * ``` |
|
2388 |
+ * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true |
|
2389 |
+ * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true |
|
2390 |
+ * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true |
|
2391 |
+ * Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false |
|
2392 |
+ * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true |
|
2393 |
+ * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false |
|
2394 |
+ * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false |
|
2395 |
+ * ``` |
|
2396 |
+ * |
|
2397 |
+ * @param bool $checkMicroseconds check time at microseconds precision |
|
2398 |
+ * |
|
2399 |
+ * @return bool |
|
2400 |
+ */ |
|
2401 |
+ public function isEndOfDay($checkMicroseconds = false); |
|
2402 |
+ |
|
2403 |
+ /** |
|
2404 |
+ * Determines if the instance is in the future, ie. greater (after) than now. |
|
2405 |
+ * |
|
2406 |
+ * @example |
|
2407 |
+ * ``` |
|
2408 |
+ * Carbon::now()->addHours(5)->isFuture(); // true |
|
2409 |
+ * Carbon::now()->subHours(5)->isFuture(); // false |
|
2410 |
+ * ``` |
|
2411 |
+ * |
|
2412 |
+ * @return bool |
|
2413 |
+ */ |
|
2414 |
+ public function isFuture(); |
|
2415 |
+ |
|
2416 |
+ /** |
|
2417 |
+ * Returns true if the current class/instance is immutable. |
|
2418 |
+ * |
|
2419 |
+ * @return bool |
|
2420 |
+ */ |
|
2421 |
+ public static function isImmutable(); |
|
2422 |
+ |
|
2423 |
+ /** |
|
2424 |
+ * Check if today is the last day of the Month |
|
2425 |
+ * |
|
2426 |
+ * @example |
|
2427 |
+ * ``` |
|
2428 |
+ * Carbon::parse('2019-02-28')->isLastOfMonth(); // true |
|
2429 |
+ * Carbon::parse('2019-03-28')->isLastOfMonth(); // false |
|
2430 |
+ * Carbon::parse('2019-03-30')->isLastOfMonth(); // false |
|
2431 |
+ * Carbon::parse('2019-03-31')->isLastOfMonth(); // true |
|
2432 |
+ * Carbon::parse('2019-04-30')->isLastOfMonth(); // true |
|
2433 |
+ * ``` |
|
2434 |
+ * |
|
2435 |
+ * @return bool |
|
2436 |
+ */ |
|
2437 |
+ public function isLastOfMonth(); |
|
2438 |
+ |
|
2439 |
+ /** |
|
2440 |
+ * Determines if the instance is a leap year. |
|
2441 |
+ * |
|
2442 |
+ * @example |
|
2443 |
+ * ``` |
|
2444 |
+ * Carbon::parse('2020-01-01')->isLeapYear(); // true |
|
2445 |
+ * Carbon::parse('2019-01-01')->isLeapYear(); // false |
|
2446 |
+ * ``` |
|
2447 |
+ * |
|
2448 |
+ * @return bool |
|
2449 |
+ */ |
|
2450 |
+ public function isLeapYear(); |
|
2451 |
+ |
|
2452 |
+ /** |
|
2453 |
+ * Determines if the instance is a long year |
|
2454 |
+ * |
|
2455 |
+ * @example |
|
2456 |
+ * ``` |
|
2457 |
+ * Carbon::parse('2015-01-01')->isLongYear(); // true |
|
2458 |
+ * Carbon::parse('2016-01-01')->isLongYear(); // false |
|
2459 |
+ * ``` |
|
2460 |
+ * |
|
2461 |
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates |
|
2462 |
+ * |
|
2463 |
+ * @return bool |
|
2464 |
+ */ |
|
2465 |
+ public function isLongYear(); |
|
2466 |
+ |
|
2467 |
+ /** |
|
2468 |
+ * Check if the instance is midday. |
|
2469 |
+ * |
|
2470 |
+ * @example |
|
2471 |
+ * ``` |
|
2472 |
+ * Carbon::parse('2019-02-28 11:59:59.999999')->isMidday(); // false |
|
2473 |
+ * Carbon::parse('2019-02-28 12:00:00')->isMidday(); // true |
|
2474 |
+ * Carbon::parse('2019-02-28 12:00:00.999999')->isMidday(); // true |
|
2475 |
+ * Carbon::parse('2019-02-28 12:00:01')->isMidday(); // false |
|
2476 |
+ * ``` |
|
2477 |
+ * |
|
2478 |
+ * @return bool |
|
2479 |
+ */ |
|
2480 |
+ public function isMidday(); |
|
2481 |
+ |
|
2482 |
+ /** |
|
2483 |
+ * Check if the instance is start of day / midnight. |
|
2484 |
+ * |
|
2485 |
+ * @example |
|
2486 |
+ * ``` |
|
2487 |
+ * Carbon::parse('2019-02-28 00:00:00')->isMidnight(); // true |
|
2488 |
+ * Carbon::parse('2019-02-28 00:00:00.999999')->isMidnight(); // true |
|
2489 |
+ * Carbon::parse('2019-02-28 00:00:01')->isMidnight(); // false |
|
2490 |
+ * ``` |
|
2491 |
+ * |
|
2492 |
+ * @return bool |
|
2493 |
+ */ |
|
2494 |
+ public function isMidnight(); |
|
2495 |
+ |
|
2496 |
+ /** |
|
2497 |
+ * Returns true if a property can be changed via setter. |
|
2498 |
+ * |
|
2499 |
+ * @param string $unit |
|
2500 |
+ * |
|
2501 |
+ * @return bool |
|
2502 |
+ */ |
|
2503 |
+ public static function isModifiableUnit($unit); |
|
2504 |
+ |
|
2505 |
+ /** |
|
2506 |
+ * Returns true if the current class/instance is mutable. |
|
2507 |
+ * |
|
2508 |
+ * @return bool |
|
2509 |
+ */ |
|
2510 |
+ public static function isMutable(); |
|
2511 |
+ |
|
2512 |
+ /** |
|
2513 |
+ * Determines if the instance is in the past, ie. less (before) than now. |
|
2514 |
+ * |
|
2515 |
+ * @example |
|
2516 |
+ * ``` |
|
2517 |
+ * Carbon::now()->subHours(5)->isPast(); // true |
|
2518 |
+ * Carbon::now()->addHours(5)->isPast(); // false |
|
2519 |
+ * ``` |
|
2520 |
+ * |
|
2521 |
+ * @return bool |
|
2522 |
+ */ |
|
2523 |
+ public function isPast(); |
|
2524 |
+ |
|
2525 |
+ /** |
|
2526 |
+ * Compares the formatted values of the two dates. |
|
2527 |
+ * |
|
2528 |
+ * @example |
|
2529 |
+ * ``` |
|
2530 |
+ * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true |
|
2531 |
+ * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false |
|
2532 |
+ * ``` |
|
2533 |
+ * |
|
2534 |
+ * @param string $format date formats to compare. |
|
2535 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. |
|
2536 |
+ * |
|
2537 |
+ * @throws \InvalidArgumentException |
|
2538 |
+ * |
|
2539 |
+ * @return bool |
|
2540 |
+ */ |
|
2541 |
+ public function isSameAs($format, $date = null); |
|
2542 |
+ |
|
2543 |
+ /** |
|
2544 |
+ * Checks if the passed in date is in the same month as the instance´s month. |
|
2545 |
+ * |
|
2546 |
+ * @example |
|
2547 |
+ * ``` |
|
2548 |
+ * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true |
|
2549 |
+ * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false |
|
2550 |
+ * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false |
|
2551 |
+ * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true |
|
2552 |
+ * ``` |
|
2553 |
+ * |
|
2554 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. |
|
2555 |
+ * @param bool $ofSameYear Check if it is the same month in the same year. |
|
2556 |
+ * |
|
2557 |
+ * @return bool |
|
2558 |
+ */ |
|
2559 |
+ public function isSameMonth($date = null, $ofSameYear = true); |
|
2560 |
+ |
|
2561 |
+ /** |
|
2562 |
+ * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). |
|
2563 |
+ * |
|
2564 |
+ * @example |
|
2565 |
+ * ``` |
|
2566 |
+ * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true |
|
2567 |
+ * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false |
|
2568 |
+ * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false |
|
2569 |
+ * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true |
|
2570 |
+ * ``` |
|
2571 |
+ * |
|
2572 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. |
|
2573 |
+ * @param bool $ofSameYear Check if it is the same month in the same year. |
|
2574 |
+ * |
|
2575 |
+ * @return bool |
|
2576 |
+ */ |
|
2577 |
+ public function isSameQuarter($date = null, $ofSameYear = true); |
|
2578 |
+ |
|
2579 |
+ /** |
|
2580 |
+ * Determines if the instance is in the current unit given. |
|
2581 |
+ * |
|
2582 |
+ * @example |
|
2583 |
+ * ``` |
|
2584 |
+ * Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true |
|
2585 |
+ * Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false |
|
2586 |
+ * ``` |
|
2587 |
+ * |
|
2588 |
+ * @param string $unit singular unit string |
|
2589 |
+ * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. |
|
2590 |
+ * |
|
2591 |
+ * @throws \InvalidArgumentException |
|
2592 |
+ * |
|
2593 |
+ * @return bool |
|
2594 |
+ */ |
|
2595 |
+ public function isSameUnit($unit, $date = null); |
|
2596 |
+ |
|
2597 |
+ /** |
|
2598 |
+ * Check if the instance is start of day / midnight. |
|
2599 |
+ * |
|
2600 |
+ * @example |
|
2601 |
+ * ``` |
|
2602 |
+ * Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true |
|
2603 |
+ * Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true |
|
2604 |
+ * Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false |
|
2605 |
+ * Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true |
|
2606 |
+ * Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false |
|
2607 |
+ * ``` |
|
2608 |
+ * |
|
2609 |
+ * @param bool $checkMicroseconds check time at microseconds precision |
|
2610 |
+ * |
|
2611 |
+ * @return bool |
|
2612 |
+ */ |
|
2613 |
+ public function isStartOfDay($checkMicroseconds = false); |
|
2614 |
+ |
|
2615 |
+ /** |
|
2616 |
+ * Returns true if the strict mode is globally in use, false else. |
|
2617 |
+ * (It can be overridden in specific instances.) |
|
2618 |
+ * |
|
2619 |
+ * @return bool |
|
2620 |
+ */ |
|
2621 |
+ public static function isStrictModeEnabled(); |
|
2622 |
+ |
|
2623 |
+ /** |
|
2624 |
+ * Determines if the instance is today. |
|
2625 |
+ * |
|
2626 |
+ * @example |
|
2627 |
+ * ``` |
|
2628 |
+ * Carbon::today()->isToday(); // true |
|
2629 |
+ * Carbon::tomorrow()->isToday(); // false |
|
2630 |
+ * ``` |
|
2631 |
+ * |
|
2632 |
+ * @return bool |
|
2633 |
+ */ |
|
2634 |
+ public function isToday(); |
|
2635 |
+ |
|
2636 |
+ /** |
|
2637 |
+ * Determines if the instance is tomorrow. |
|
2638 |
+ * |
|
2639 |
+ * @example |
|
2640 |
+ * ``` |
|
2641 |
+ * Carbon::tomorrow()->isTomorrow(); // true |
|
2642 |
+ * Carbon::yesterday()->isTomorrow(); // false |
|
2643 |
+ * ``` |
|
2644 |
+ * |
|
2645 |
+ * @return bool |
|
2646 |
+ */ |
|
2647 |
+ public function isTomorrow(); |
|
2648 |
+ |
|
2649 |
+ /** |
|
2650 |
+ * Determines if the instance is a weekday. |
|
2651 |
+ * |
|
2652 |
+ * @example |
|
2653 |
+ * ``` |
|
2654 |
+ * Carbon::parse('2019-07-14')->isWeekday(); // false |
|
2655 |
+ * Carbon::parse('2019-07-15')->isWeekday(); // true |
|
2656 |
+ * ``` |
|
2657 |
+ * |
|
2658 |
+ * @return bool |
|
2659 |
+ */ |
|
2660 |
+ public function isWeekday(); |
|
2661 |
+ |
|
2662 |
+ /** |
|
2663 |
+ * Determines if the instance is a weekend day. |
|
2664 |
+ * |
|
2665 |
+ * @example |
|
2666 |
+ * ``` |
|
2667 |
+ * Carbon::parse('2019-07-14')->isWeekend(); // true |
|
2668 |
+ * Carbon::parse('2019-07-15')->isWeekend(); // false |
|
2669 |
+ * ``` |
|
2670 |
+ * |
|
2671 |
+ * @return bool |
|
2672 |
+ */ |
|
2673 |
+ public function isWeekend(); |
|
2674 |
+ |
|
2675 |
+ /** |
|
2676 |
+ * Determines if the instance is yesterday. |
|
2677 |
+ * |
|
2678 |
+ * @example |
|
2679 |
+ * ``` |
|
2680 |
+ * Carbon::yesterday()->isYesterday(); // true |
|
2681 |
+ * Carbon::tomorrow()->isYesterday(); // false |
|
2682 |
+ * ``` |
|
2683 |
+ * |
|
2684 |
+ * @return bool |
|
2685 |
+ */ |
|
2686 |
+ public function isYesterday(); |
|
2687 |
+ |
|
2688 |
+ /** |
|
2689 |
+ * Format in the current language using ISO replacement patterns. |
|
2690 |
+ * |
|
2691 |
+ * @param string $format |
|
2692 |
+ * @param string|null $originalFormat provide context if a chunk has been passed alone |
|
2693 |
+ * |
|
2694 |
+ * @return string |
|
2695 |
+ */ |
|
2696 |
+ public function isoFormat(string $format, string $originalFormat = null): string; |
|
2697 |
+ |
|
2698 |
+ /** |
|
2699 |
+ * Get/set the week number using given first day of week and first |
|
2700 |
+ * day of year included in the first week. Or use ISO format if no settings |
|
2701 |
+ * given. |
|
2702 |
+ * |
|
2703 |
+ * @param int|null $week |
|
2704 |
+ * @param int|null $dayOfWeek |
|
2705 |
+ * @param int|null $dayOfYear |
|
2706 |
+ * |
|
2707 |
+ * @return int|static |
|
2708 |
+ */ |
|
2709 |
+ public function isoWeek($week = null, $dayOfWeek = null, $dayOfYear = null); |
|
2710 |
+ |
|
2711 |
+ /** |
|
2712 |
+ * Set/get the week number of year using given first day of week and first |
|
2713 |
+ * day of year included in the first week. Or use ISO format if no settings |
|
2714 |
+ * given. |
|
2715 |
+ * |
|
2716 |
+ * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. |
|
2717 |
+ * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
2718 |
+ * @param int|null $dayOfYear first day of year included in the week #1 |
|
2719 |
+ * |
|
2720 |
+ * @return int|static |
|
2721 |
+ */ |
|
2722 |
+ public function isoWeekYear($year = null, $dayOfWeek = null, $dayOfYear = null); |
|
2723 |
+ |
|
2724 |
+ /** |
|
2725 |
+ * Get/set the ISO weekday from 1 (Monday) to 7 (Sunday). |
|
2726 |
+ * |
|
2727 |
+ * @param int|null $value new value for weekday if using as setter. |
|
2728 |
+ * |
|
2729 |
+ * @return static|int |
|
2730 |
+ */ |
|
2731 |
+ public function isoWeekday($value = null); |
|
2732 |
+ |
|
2733 |
+ /** |
|
2734 |
+ * Get the number of weeks of the current week-year using given first day of week and first |
|
2735 |
+ * day of year included in the first week. Or use ISO format if no settings |
|
2736 |
+ * given. |
|
2737 |
+ * |
|
2738 |
+ * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
2739 |
+ * @param int|null $dayOfYear first day of year included in the week #1 |
|
2740 |
+ * |
|
2741 |
+ * @return int |
|
2742 |
+ */ |
|
2743 |
+ public function isoWeeksInYear($dayOfWeek = null, $dayOfYear = null); |
|
2744 |
+ |
|
2745 |
+ /** |
|
2746 |
+ * Prepare the object for JSON serialization. |
|
2747 |
+ * |
|
2748 |
+ * @return array|string |
|
2749 |
+ */ |
|
2750 |
+ public function jsonSerialize(); |
|
2751 |
+ |
|
2752 |
+ /** |
|
2753 |
+ * Modify to the last occurrence of a given day of the week |
|
2754 |
+ * in the current month. If no dayOfWeek is provided, modify to the |
|
2755 |
+ * last day of the current month. Use the supplied constants |
|
2756 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2757 |
+ * |
|
2758 |
+ * @param int|null $dayOfWeek |
|
2759 |
+ * |
|
2760 |
+ * @return static |
|
2761 |
+ */ |
|
2762 |
+ public function lastOfMonth($dayOfWeek = null); |
|
2763 |
+ |
|
2764 |
+ /** |
|
2765 |
+ * Modify to the last occurrence of a given day of the week |
|
2766 |
+ * in the current quarter. If no dayOfWeek is provided, modify to the |
|
2767 |
+ * last day of the current quarter. Use the supplied constants |
|
2768 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2769 |
+ * |
|
2770 |
+ * @param int|null $dayOfWeek day of the week default null |
|
2771 |
+ * |
|
2772 |
+ * @return static |
|
2773 |
+ */ |
|
2774 |
+ public function lastOfQuarter($dayOfWeek = null); |
|
2775 |
+ |
|
2776 |
+ /** |
|
2777 |
+ * Modify to the last occurrence of a given day of the week |
|
2778 |
+ * in the current year. If no dayOfWeek is provided, modify to the |
|
2779 |
+ * last day of the current year. Use the supplied constants |
|
2780 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
2781 |
+ * |
|
2782 |
+ * @param int|null $dayOfWeek day of the week default null |
|
2783 |
+ * |
|
2784 |
+ * @return static |
|
2785 |
+ */ |
|
2786 |
+ public function lastOfYear($dayOfWeek = null); |
|
2787 |
+ |
|
2788 |
+ /** |
|
2789 |
+ * Determines if the instance is less (before) than another |
|
2790 |
+ * |
|
2791 |
+ * @example |
|
2792 |
+ * ``` |
|
2793 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false |
|
2794 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:18'); // false |
|
2795 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true |
|
2796 |
+ * ``` |
|
2797 |
+ * |
|
2798 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2799 |
+ * |
|
2800 |
+ * @return bool |
|
2801 |
+ */ |
|
2802 |
+ public function lessThan($date): bool; |
|
2803 |
+ |
|
2804 |
+ /** |
|
2805 |
+ * Determines if the instance is less (before) or equal to another |
|
2806 |
+ * |
|
2807 |
+ * @example |
|
2808 |
+ * ``` |
|
2809 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true |
|
2810 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:18'); // false |
|
2811 |
+ * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true |
|
2812 |
+ * ``` |
|
2813 |
+ * |
|
2814 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2815 |
+ * |
|
2816 |
+ * @return bool |
|
2817 |
+ */ |
|
2818 |
+ public function lessThanOrEqualTo($date): bool; |
|
2819 |
+ |
|
2820 |
+ /** |
|
2821 |
+ * Get/set the locale for the current instance. |
|
2822 |
+ * |
|
2823 |
+ * @param string|null $locale |
|
2824 |
+ * @param string[] ...$fallbackLocales |
|
2825 |
+ * |
|
2826 |
+ * @return $this|string |
|
2827 |
+ */ |
|
2828 |
+ public function locale(string $locale = null, ...$fallbackLocales); |
|
2829 |
+ |
|
2830 |
+ /** |
|
2831 |
+ * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). |
|
2832 |
+ * Support is considered enabled if the 3 words are translated in the given locale. |
|
2833 |
+ * |
|
2834 |
+ * @param string $locale locale ex. en |
|
2835 |
+ * |
|
2836 |
+ * @return bool |
|
2837 |
+ */ |
|
2838 |
+ public static function localeHasDiffOneDayWords($locale); |
|
2839 |
+ |
|
2840 |
+ /** |
|
2841 |
+ * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). |
|
2842 |
+ * Support is considered enabled if the 4 sentences are translated in the given locale. |
|
2843 |
+ * |
|
2844 |
+ * @param string $locale locale ex. en |
|
2845 |
+ * |
|
2846 |
+ * @return bool |
|
2847 |
+ */ |
|
2848 |
+ public static function localeHasDiffSyntax($locale); |
|
2849 |
+ |
|
2850 |
+ /** |
|
2851 |
+ * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). |
|
2852 |
+ * Support is considered enabled if the 2 words are translated in the given locale. |
|
2853 |
+ * |
|
2854 |
+ * @param string $locale locale ex. en |
|
2855 |
+ * |
|
2856 |
+ * @return bool |
|
2857 |
+ */ |
|
2858 |
+ public static function localeHasDiffTwoDayWords($locale); |
|
2859 |
+ |
|
2860 |
+ /** |
|
2861 |
+ * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). |
|
2862 |
+ * Support is considered enabled if the 4 sentences are translated in the given locale. |
|
2863 |
+ * |
|
2864 |
+ * @param string $locale locale ex. en |
|
2865 |
+ * |
|
2866 |
+ * @return bool |
|
2867 |
+ */ |
|
2868 |
+ public static function localeHasPeriodSyntax($locale); |
|
2869 |
+ |
|
2870 |
+ /** |
|
2871 |
+ * Returns true if the given locale is internally supported and has short-units support. |
|
2872 |
+ * Support is considered enabled if either year, day or hour has a short variant translated. |
|
2873 |
+ * |
|
2874 |
+ * @param string $locale locale ex. en |
|
2875 |
+ * |
|
2876 |
+ * @return bool |
|
2877 |
+ */ |
|
2878 |
+ public static function localeHasShortUnits($locale); |
|
2879 |
+ |
|
2880 |
+ /** |
|
2881 |
+ * Determines if the instance is less (before) than another |
|
2882 |
+ * |
|
2883 |
+ * @example |
|
2884 |
+ * ``` |
|
2885 |
+ * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false |
|
2886 |
+ * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:18'); // false |
|
2887 |
+ * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true |
|
2888 |
+ * ``` |
|
2889 |
+ * |
|
2890 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2891 |
+ * |
|
2892 |
+ * @see lessThan() |
|
2893 |
+ * |
|
2894 |
+ * @return bool |
|
2895 |
+ */ |
|
2896 |
+ public function lt($date): bool; |
|
2897 |
+ |
|
2898 |
+ /** |
|
2899 |
+ * Determines if the instance is less (before) or equal to another |
|
2900 |
+ * |
|
2901 |
+ * @example |
|
2902 |
+ * ``` |
|
2903 |
+ * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true |
|
2904 |
+ * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:18'); // false |
|
2905 |
+ * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true |
|
2906 |
+ * ``` |
|
2907 |
+ * |
|
2908 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2909 |
+ * |
|
2910 |
+ * @see lessThanOrEqualTo() |
|
2911 |
+ * |
|
2912 |
+ * @return bool |
|
2913 |
+ */ |
|
2914 |
+ public function lte($date): bool; |
|
2915 |
+ |
|
2916 |
+ /** |
|
2917 |
+ * Register a custom macro. |
|
2918 |
+ * |
|
2919 |
+ * @example |
|
2920 |
+ * ``` |
|
2921 |
+ * $userSettings = [ |
|
2922 |
+ * 'locale' => 'pt', |
|
2923 |
+ * 'timezone' => 'America/Sao_Paulo', |
|
2924 |
+ * ]; |
|
2925 |
+ * Carbon::macro('userFormat', function () use ($userSettings) { |
|
2926 |
+ * return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar(); |
|
2927 |
+ * }); |
|
2928 |
+ * echo Carbon::yesterday()->hours(11)->userFormat(); |
|
2929 |
+ * ``` |
|
2930 |
+ * |
|
2931 |
+ * @param string $name |
|
2932 |
+ * @param object|callable $macro |
|
2933 |
+ * |
|
2934 |
+ * @return void |
|
2935 |
+ */ |
|
2936 |
+ public static function macro($name, $macro); |
|
2937 |
+ |
|
2938 |
+ /** |
|
2939 |
+ * Make a Carbon instance from given variable if possible. |
|
2940 |
+ * |
|
2941 |
+ * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals |
|
2942 |
+ * and recurrences). Throw an exception for invalid format, but otherwise return null. |
|
2943 |
+ * |
|
2944 |
+ * @param mixed $var |
|
2945 |
+ * |
|
2946 |
+ * @return static|null |
|
2947 |
+ */ |
|
2948 |
+ public static function make($var); |
|
2949 |
+ |
|
2950 |
+ /** |
|
2951 |
+ * Get the maximum instance between a given instance (default now) and the current instance. |
|
2952 |
+ * |
|
2953 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2954 |
+ * |
|
2955 |
+ * @return static |
|
2956 |
+ */ |
|
2957 |
+ public function max($date = null); |
|
2958 |
+ |
|
2959 |
+ /** |
|
2960 |
+ * Create a Carbon instance for the greatest supported date. |
|
2961 |
+ * |
|
2962 |
+ * @return static |
|
2963 |
+ */ |
|
2964 |
+ public static function maxValue(); |
|
2965 |
+ |
|
2966 |
+ /** |
|
2967 |
+ * Get the maximum instance between a given instance (default now) and the current instance. |
|
2968 |
+ * |
|
2969 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2970 |
+ * |
|
2971 |
+ * @see max() |
|
2972 |
+ * |
|
2973 |
+ * @return static |
|
2974 |
+ */ |
|
2975 |
+ public function maximum($date = null); |
|
2976 |
+ |
|
2977 |
+ /** |
|
2978 |
+ * Return the meridiem of the current time in the current locale. |
|
2979 |
+ * |
|
2980 |
+ * @param bool $isLower if true, returns lowercase variant if available in the current locale. |
|
2981 |
+ * |
|
2982 |
+ * @return string |
|
2983 |
+ */ |
|
2984 |
+ public function meridiem(bool $isLower = false): string; |
|
2985 |
+ |
|
2986 |
+ /** |
|
2987 |
+ * Modify to midday, default to self::$midDayAt |
|
2988 |
+ * |
|
2989 |
+ * @return static |
|
2990 |
+ */ |
|
2991 |
+ public function midDay(); |
|
2992 |
+ |
|
2993 |
+ /** |
|
2994 |
+ * Get the minimum instance between a given instance (default now) and the current instance. |
|
2995 |
+ * |
|
2996 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
2997 |
+ * |
|
2998 |
+ * @return static |
|
2999 |
+ */ |
|
3000 |
+ public function min($date = null); |
|
3001 |
+ |
|
3002 |
+ /** |
|
3003 |
+ * Create a Carbon instance for the lowest supported date. |
|
3004 |
+ * |
|
3005 |
+ * @return static |
|
3006 |
+ */ |
|
3007 |
+ public static function minValue(); |
|
3008 |
+ |
|
3009 |
+ /** |
|
3010 |
+ * Get the minimum instance between a given instance (default now) and the current instance. |
|
3011 |
+ * |
|
3012 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3013 |
+ * |
|
3014 |
+ * @see min() |
|
3015 |
+ * |
|
3016 |
+ * @return static |
|
3017 |
+ */ |
|
3018 |
+ public function minimum($date = null); |
|
3019 |
+ |
|
3020 |
+ /** |
|
3021 |
+ * Mix another object into the class. |
|
3022 |
+ * |
|
3023 |
+ * @example |
|
3024 |
+ * ``` |
|
3025 |
+ * Carbon::mixin(new class { |
|
3026 |
+ * public function addMoon() { |
|
3027 |
+ * return function () { |
|
3028 |
+ * return $this->addDays(30); |
|
3029 |
+ * }; |
|
3030 |
+ * } |
|
3031 |
+ * public function subMoon() { |
|
3032 |
+ * return function () { |
|
3033 |
+ * return $this->subDays(30); |
|
3034 |
+ * }; |
|
3035 |
+ * } |
|
3036 |
+ * }); |
|
3037 |
+ * $fullMoon = Carbon::create('2018-12-22'); |
|
3038 |
+ * $nextFullMoon = $fullMoon->addMoon(); |
|
3039 |
+ * $blackMoon = Carbon::create('2019-01-06'); |
|
3040 |
+ * $previousBlackMoon = $blackMoon->subMoon(); |
|
3041 |
+ * echo "$nextFullMoon\n"; |
|
3042 |
+ * echo "$previousBlackMoon\n"; |
|
3043 |
+ * ``` |
|
3044 |
+ * |
|
3045 |
+ * @param object|string $mixin |
|
3046 |
+ * |
|
3047 |
+ * @throws \ReflectionException |
|
3048 |
+ * |
|
3049 |
+ * @return void |
|
3050 |
+ */ |
|
3051 |
+ public static function mixin($mixin); |
|
3052 |
+ |
|
3053 |
+ /** |
|
3054 |
+ * call \DateTime::modify if mutable or \DateTimeImmutable::modify else. |
|
3055 |
+ * |
|
3056 |
+ * @see https://php.net/manual/en/datetime.modify.php |
|
3057 |
+ */ |
|
3058 |
+ public function modify($modify); |
|
3059 |
+ |
|
3060 |
+ /** |
|
3061 |
+ * Determines if the instance is not equal to another |
|
3062 |
+ * |
|
3063 |
+ * @example |
|
3064 |
+ * ``` |
|
3065 |
+ * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false |
|
3066 |
+ * Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false |
|
3067 |
+ * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true |
|
3068 |
+ * ``` |
|
3069 |
+ * |
|
3070 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3071 |
+ * |
|
3072 |
+ * @see notEqualTo() |
|
3073 |
+ * |
|
3074 |
+ * @return bool |
|
3075 |
+ */ |
|
3076 |
+ public function ne($date): bool; |
|
3077 |
+ |
|
3078 |
+ /** |
|
3079 |
+ * Modify to the next occurrence of a given modifier such as a day of |
|
3080 |
+ * the week. If no modifier is provided, modify to the next occurrence |
|
3081 |
+ * of the current day of the week. Use the supplied constants |
|
3082 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3083 |
+ * |
|
3084 |
+ * @param string|int|null $modifier |
|
3085 |
+ * |
|
3086 |
+ * @return static |
|
3087 |
+ */ |
|
3088 |
+ public function next($modifier = null); |
|
3089 |
+ |
|
3090 |
+ /** |
|
3091 |
+ * Go forward to the next weekday. |
|
3092 |
+ * |
|
3093 |
+ * @return static |
|
3094 |
+ */ |
|
3095 |
+ public function nextWeekday(); |
|
3096 |
+ |
|
3097 |
+ /** |
|
3098 |
+ * Go forward to the next weekend day. |
|
3099 |
+ * |
|
3100 |
+ * @return static |
|
3101 |
+ */ |
|
3102 |
+ public function nextWeekendDay(); |
|
3103 |
+ |
|
3104 |
+ /** |
|
3105 |
+ * Determines if the instance is not equal to another |
|
3106 |
+ * |
|
3107 |
+ * @example |
|
3108 |
+ * ``` |
|
3109 |
+ * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false |
|
3110 |
+ * Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false |
|
3111 |
+ * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true |
|
3112 |
+ * ``` |
|
3113 |
+ * |
|
3114 |
+ * @param \Carbon\Carbon|\DateTimeInterface|mixed $date |
|
3115 |
+ * |
|
3116 |
+ * @return bool |
|
3117 |
+ */ |
|
3118 |
+ public function notEqualTo($date): bool; |
|
3119 |
+ |
|
3120 |
+ /** |
|
3121 |
+ * Get a Carbon instance for the current date and time. |
|
3122 |
+ * |
|
3123 |
+ * @param \DateTimeZone|string|null $tz |
|
3124 |
+ * |
|
3125 |
+ * @return static |
|
3126 |
+ */ |
|
3127 |
+ public static function now($tz = null); |
|
3128 |
+ |
|
3129 |
+ /** |
|
3130 |
+ * Returns a present instance in the same timezone. |
|
3131 |
+ * |
|
3132 |
+ * @return static |
|
3133 |
+ */ |
|
3134 |
+ public function nowWithSameTz(); |
|
3135 |
+ |
|
3136 |
+ /** |
|
3137 |
+ * Modify to the given occurrence of a given day of the week |
|
3138 |
+ * in the current month. If the calculated occurrence is outside the scope |
|
3139 |
+ * of the current month, then return false and no modifications are made. |
|
3140 |
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3141 |
+ * |
|
3142 |
+ * @param int $nth |
|
3143 |
+ * @param int $dayOfWeek |
|
3144 |
+ * |
|
3145 |
+ * @return mixed |
|
3146 |
+ */ |
|
3147 |
+ public function nthOfMonth($nth, $dayOfWeek); |
|
3148 |
+ |
|
3149 |
+ /** |
|
3150 |
+ * Modify to the given occurrence of a given day of the week |
|
3151 |
+ * in the current quarter. If the calculated occurrence is outside the scope |
|
3152 |
+ * of the current quarter, then return false and no modifications are made. |
|
3153 |
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3154 |
+ * |
|
3155 |
+ * @param int $nth |
|
3156 |
+ * @param int $dayOfWeek |
|
3157 |
+ * |
|
3158 |
+ * @return mixed |
|
3159 |
+ */ |
|
3160 |
+ public function nthOfQuarter($nth, $dayOfWeek); |
|
3161 |
+ |
|
3162 |
+ /** |
|
3163 |
+ * Modify to the given occurrence of a given day of the week |
|
3164 |
+ * in the current year. If the calculated occurrence is outside the scope |
|
3165 |
+ * of the current year, then return false and no modifications are made. |
|
3166 |
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3167 |
+ * |
|
3168 |
+ * @param int $nth |
|
3169 |
+ * @param int $dayOfWeek |
|
3170 |
+ * |
|
3171 |
+ * @return mixed |
|
3172 |
+ */ |
|
3173 |
+ public function nthOfYear($nth, $dayOfWeek); |
|
3174 |
+ |
|
3175 |
+ /** |
|
3176 |
+ * Return a property with its ordinal. |
|
3177 |
+ * |
|
3178 |
+ * @param string $key |
|
3179 |
+ * @param string|null $period |
|
3180 |
+ * |
|
3181 |
+ * @return string |
|
3182 |
+ */ |
|
3183 |
+ public function ordinal(string $key, string $period = null): string; |
|
3184 |
+ |
|
3185 |
+ /** |
|
3186 |
+ * Create a carbon instance from a string. |
|
3187 |
+ * |
|
3188 |
+ * This is an alias for the constructor that allows better fluent syntax |
|
3189 |
+ * as it allows you to do Carbon::parse('Monday next week')->fn() rather |
|
3190 |
+ * than (new Carbon('Monday next week'))->fn(). |
|
3191 |
+ * |
|
3192 |
+ * @param string|null $time |
|
3193 |
+ * @param \DateTimeZone|string|null $tz |
|
3194 |
+ * |
|
3195 |
+ * @return static |
|
3196 |
+ */ |
|
3197 |
+ public static function parse($time = null, $tz = null); |
|
3198 |
+ |
|
3199 |
+ /** |
|
3200 |
+ * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). |
|
3201 |
+ * |
|
3202 |
+ * @param string $time |
|
3203 |
+ * @param string $locale |
|
3204 |
+ * @param \DateTimeZone|string|null $tz |
|
3205 |
+ * |
|
3206 |
+ * @return static |
|
3207 |
+ */ |
|
3208 |
+ public static function parseFromLocale($time, $locale, $tz = null); |
|
3209 |
+ |
|
3210 |
+ /** |
|
3211 |
+ * Returns standardized plural of a given singular/plural unit name (in English). |
|
3212 |
+ * |
|
3213 |
+ * @param string $unit |
|
3214 |
+ * |
|
3215 |
+ * @return string |
|
3216 |
+ */ |
|
3217 |
+ public static function pluralUnit(string $unit): string; |
|
3218 |
+ |
|
3219 |
+ /** |
|
3220 |
+ * Modify to the previous occurrence of a given modifier such as a day of |
|
3221 |
+ * the week. If no dayOfWeek is provided, modify to the previous occurrence |
|
3222 |
+ * of the current day of the week. Use the supplied constants |
|
3223 |
+ * to indicate the desired dayOfWeek, ex. static::MONDAY. |
|
3224 |
+ * |
|
3225 |
+ * @param string|int|null $modifier |
|
3226 |
+ * |
|
3227 |
+ * @return static |
|
3228 |
+ */ |
|
3229 |
+ public function previous($modifier = null); |
|
3230 |
+ |
|
3231 |
+ /** |
|
3232 |
+ * Go backward to the previous weekday. |
|
3233 |
+ * |
|
3234 |
+ * @return static |
|
3235 |
+ */ |
|
3236 |
+ public function previousWeekday(); |
|
3237 |
+ |
|
3238 |
+ /** |
|
3239 |
+ * Go backward to the previous weekend day. |
|
3240 |
+ * |
|
3241 |
+ * @return static |
|
3242 |
+ */ |
|
3243 |
+ public function previousWeekendDay(); |
|
3244 |
+ |
|
3245 |
+ /** |
|
3246 |
+ * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). |
|
3247 |
+ * |
|
3248 |
+ * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date |
|
3249 |
+ * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit |
|
3250 |
+ * @param string|null $unit if specified, $interval must be an integer |
|
3251 |
+ * |
|
3252 |
+ * @return CarbonPeriod |
|
3253 |
+ */ |
|
3254 |
+ public function range($end = null, $interval = null, $unit = null); |
|
3255 |
+ |
|
3256 |
+ /** |
|
3257 |
+ * Create a Carbon instance from a specific format. |
|
3258 |
+ * |
|
3259 |
+ * @param string $format Datetime format |
|
3260 |
+ * @param string $time |
|
3261 |
+ * @param \DateTimeZone|string|false|null $tz |
|
3262 |
+ * |
|
3263 |
+ * @throws InvalidArgumentException |
|
3264 |
+ * |
|
3265 |
+ * @return static|false |
|
3266 |
+ */ |
|
3267 |
+ public static function rawCreateFromFormat($format, $time, $tz = null); |
|
3268 |
+ |
|
3269 |
+ /** |
|
3270 |
+ * @see https://php.net/manual/en/datetime.format.php |
|
3271 |
+ * |
|
3272 |
+ * @param string $format |
|
3273 |
+ * |
|
3274 |
+ * @return string |
|
3275 |
+ */ |
|
3276 |
+ public function rawFormat($format); |
|
3277 |
+ |
|
3278 |
+ /** |
|
3279 |
+ * Create a carbon instance from a string. |
|
3280 |
+ * |
|
3281 |
+ * This is an alias for the constructor that allows better fluent syntax |
|
3282 |
+ * as it allows you to do Carbon::parse('Monday next week')->fn() rather |
|
3283 |
+ * than (new Carbon('Monday next week'))->fn(). |
|
3284 |
+ * |
|
3285 |
+ * @param string|null $time |
|
3286 |
+ * @param \DateTimeZone|string|null $tz |
|
3287 |
+ * |
|
3288 |
+ * @return static |
|
3289 |
+ */ |
|
3290 |
+ public static function rawParse($time = null, $tz = null); |
|
3291 |
+ |
|
3292 |
+ /** |
|
3293 |
+ * Remove all macros and generic macros. |
|
3294 |
+ */ |
|
3295 |
+ public static function resetMacros(); |
|
3296 |
+ |
|
3297 |
+ /** |
|
3298 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3299 |
+ * You should rather use the ->settings() method. |
|
3300 |
+ * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants |
|
3301 |
+ * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
3302 |
+ * @see settings |
|
3303 |
+ * |
|
3304 |
+ * Reset the month overflow behavior. |
|
3305 |
+ * |
|
3306 |
+ * @return void |
|
3307 |
+ */ |
|
3308 |
+ public static function resetMonthsOverflow(); |
|
3309 |
+ |
|
3310 |
+ /** |
|
3311 |
+ * Reset the format used to the default when type juggling a Carbon instance to a string |
|
3312 |
+ * |
|
3313 |
+ * @return void |
|
3314 |
+ */ |
|
3315 |
+ public static function resetToStringFormat(); |
|
3316 |
+ |
|
3317 |
+ /** |
|
3318 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3319 |
+ * You should rather use the ->settings() method. |
|
3320 |
+ * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants |
|
3321 |
+ * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
3322 |
+ * @see settings |
|
3323 |
+ * |
|
3324 |
+ * Reset the month overflow behavior. |
|
3325 |
+ * |
|
3326 |
+ * @return void |
|
3327 |
+ */ |
|
3328 |
+ public static function resetYearsOverflow(); |
|
3329 |
+ |
|
3330 |
+ /** |
|
3331 |
+ * Round the current instance second with given precision if specified. |
|
3332 |
+ * |
|
3333 |
+ * @param float|int $precision |
|
3334 |
+ * @param string $function |
|
3335 |
+ * |
|
3336 |
+ * @return CarbonInterface |
|
3337 |
+ */ |
|
3338 |
+ public function round($precision = 1, $function = 'round'); |
|
3339 |
+ |
|
3340 |
+ /** |
|
3341 |
+ * Round the current instance at the given unit with given precision if specified and the given function. |
|
3342 |
+ * |
|
3343 |
+ * @param string $unit |
|
3344 |
+ * @param float|int $precision |
|
3345 |
+ * @param string $function |
|
3346 |
+ * |
|
3347 |
+ * @return CarbonInterface |
|
3348 |
+ */ |
|
3349 |
+ public function roundUnit($unit, $precision = 1, $function = 'round'); |
|
3350 |
+ |
|
3351 |
+ /** |
|
3352 |
+ * Round the current instance week. |
|
3353 |
+ * |
|
3354 |
+ * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
3355 |
+ * |
|
3356 |
+ * @return CarbonInterface |
|
3357 |
+ */ |
|
3358 |
+ public function roundWeek($weekStartsAt = null); |
|
3359 |
+ |
|
3360 |
+ /** |
|
3361 |
+ * The number of seconds since midnight. |
|
3362 |
+ * |
|
3363 |
+ * @return int |
|
3364 |
+ */ |
|
3365 |
+ public function secondsSinceMidnight(); |
|
3366 |
+ |
|
3367 |
+ /** |
|
3368 |
+ * The number of seconds until 23:59:59. |
|
3369 |
+ * |
|
3370 |
+ * @return int |
|
3371 |
+ */ |
|
3372 |
+ public function secondsUntilEndOfDay(); |
|
3373 |
+ |
|
3374 |
+ /** |
|
3375 |
+ * Return a serialized string of the instance. |
|
3376 |
+ * |
|
3377 |
+ * @return string |
|
3378 |
+ */ |
|
3379 |
+ public function serialize(); |
|
3380 |
+ |
|
3381 |
+ /** |
|
3382 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3383 |
+ * You should rather transform Carbon object before the serialization. |
|
3384 |
+ * |
|
3385 |
+ * JSON serialize all Carbon instances using the given callback. |
|
3386 |
+ * |
|
3387 |
+ * @param callable $callback |
|
3388 |
+ * |
|
3389 |
+ * @return void |
|
3390 |
+ */ |
|
3391 |
+ public static function serializeUsing($callback); |
|
3392 |
+ |
|
3393 |
+ /** |
|
3394 |
+ * Set a part of the Carbon object |
|
3395 |
+ * |
|
3396 |
+ * @param string|array $name |
|
3397 |
+ * @param string|int|\DateTimeZone $value |
|
3398 |
+ * |
|
3399 |
+ * @throws InvalidArgumentException|ReflectionException |
|
3400 |
+ * |
|
3401 |
+ * @return $this |
|
3402 |
+ */ |
|
3403 |
+ public function set($name, $value = null); |
|
3404 |
+ |
|
3405 |
+ public function setDate($year, $month, $day); |
|
3406 |
+ |
|
3407 |
+ /** |
|
3408 |
+ * Set the year, month, and date for this instance to that of the passed instance. |
|
3409 |
+ * |
|
3410 |
+ * @param \Carbon\Carbon|\DateTimeInterface $date now if null |
|
3411 |
+ * |
|
3412 |
+ * @return static |
|
3413 |
+ */ |
|
3414 |
+ public function setDateFrom($date = null); |
|
3415 |
+ |
|
3416 |
+ /** |
|
3417 |
+ * Set the date and time all together. |
|
3418 |
+ * |
|
3419 |
+ * @param int $year |
|
3420 |
+ * @param int $month |
|
3421 |
+ * @param int $day |
|
3422 |
+ * @param int $hour |
|
3423 |
+ * @param int $minute |
|
3424 |
+ * @param int $second |
|
3425 |
+ * @param int $microseconds |
|
3426 |
+ * |
|
3427 |
+ * @return static |
|
3428 |
+ */ |
|
3429 |
+ public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0); |
|
3430 |
+ |
|
3431 |
+ /** |
|
3432 |
+ * Set the date and time for this instance to that of the passed instance. |
|
3433 |
+ * |
|
3434 |
+ * @param \Carbon\Carbon|\DateTimeInterface $date |
|
3435 |
+ * |
|
3436 |
+ * @return static |
|
3437 |
+ */ |
|
3438 |
+ public function setDateTimeFrom($date = null); |
|
3439 |
+ |
|
3440 |
+ /** |
|
3441 |
+ * Set the fallback locale. |
|
3442 |
+ * |
|
3443 |
+ * @see https://symfony.com/doc/current/components/translation.html#fallback-locales |
|
3444 |
+ * |
|
3445 |
+ * @param string $locale |
|
3446 |
+ */ |
|
3447 |
+ public static function setFallbackLocale($locale); |
|
3448 |
+ |
|
3449 |
+ /** |
|
3450 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3451 |
+ * You should rather use the ->settings() method. |
|
3452 |
+ * @see settings |
|
3453 |
+ * |
|
3454 |
+ * @param int $humanDiffOptions |
|
3455 |
+ */ |
|
3456 |
+ public static function setHumanDiffOptions($humanDiffOptions); |
|
3457 |
+ |
|
3458 |
+ /** |
|
3459 |
+ * call \DateTime::setISODate if mutable or \DateTimeImmutable::setISODate else. |
|
3460 |
+ * |
|
3461 |
+ * @see https://php.net/manual/en/datetime.setisodate.php |
|
3462 |
+ */ |
|
3463 |
+ public function setISODate($year, $week, $day = 1); |
|
3464 |
+ |
|
3465 |
+ /** |
|
3466 |
+ * Set the translator for the current instance. |
|
3467 |
+ * |
|
3468 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
3469 |
+ * |
|
3470 |
+ * @return $this |
|
3471 |
+ */ |
|
3472 |
+ public function setLocalTranslator(\Symfony\Component\Translation\TranslatorInterface $translator); |
|
3473 |
+ |
|
3474 |
+ /** |
|
3475 |
+ * Set the current translator locale and indicate if the source locale file exists. |
|
3476 |
+ * Pass 'auto' as locale to use closest language from the current LC_TIME locale. |
|
3477 |
+ * |
|
3478 |
+ * @param string $locale locale ex. en |
|
3479 |
+ * |
|
3480 |
+ * @return bool |
|
3481 |
+ */ |
|
3482 |
+ public static function setLocale($locale); |
|
3483 |
+ |
|
3484 |
+ /** |
|
3485 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3486 |
+ * You should rather consider mid-day is always 12pm, then if you need to test if it's an other |
|
3487 |
+ * hour, test it explicitly: |
|
3488 |
+ * $date->format('G') == 13 |
|
3489 |
+ * or to set explicitly to a given hour: |
|
3490 |
+ * $date->setTime(13, 0, 0, 0) |
|
3491 |
+ * |
|
3492 |
+ * Set midday/noon hour |
|
3493 |
+ * |
|
3494 |
+ * @param int $hour midday hour |
|
3495 |
+ * |
|
3496 |
+ * @return void |
|
3497 |
+ */ |
|
3498 |
+ public static function setMidDayAt($hour); |
|
3499 |
+ |
|
3500 |
+ /** |
|
3501 |
+ * Set a Carbon instance (real or mock) to be returned when a "now" |
|
3502 |
+ * instance is created. The provided instance will be returned |
|
3503 |
+ * specifically under the following conditions: |
|
3504 |
+ * - A call to the static now() method, ex. Carbon::now() |
|
3505 |
+ * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) |
|
3506 |
+ * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') |
|
3507 |
+ * - When a string containing the desired time is passed to Carbon::parse(). |
|
3508 |
+ * |
|
3509 |
+ * Note the timezone parameter was left out of the examples above and |
|
3510 |
+ * has no affect as the mock value will be returned regardless of its value. |
|
3511 |
+ * |
|
3512 |
+ * To clear the test instance call this method using the default |
|
3513 |
+ * parameter of null. |
|
3514 |
+ * |
|
3515 |
+ * /!\ Use this method for unit tests only. |
|
3516 |
+ * |
|
3517 |
+ * @param static|string|null $testNow real or mock Carbon instance |
|
3518 |
+ */ |
|
3519 |
+ public static function setTestNow($testNow = null); |
|
3520 |
+ |
|
3521 |
+ /** |
|
3522 |
+ * call \DateTime::setTime if mutable or \DateTimeImmutable::setTime else. |
|
3523 |
+ * |
|
3524 |
+ * @see https://php.net/manual/en/datetime.settime.php |
|
3525 |
+ */ |
|
3526 |
+ public function setTime($hour, $minute, $second = 0, $microseconds = 0); |
|
3527 |
+ |
|
3528 |
+ /** |
|
3529 |
+ * Set the hour, minute, second and microseconds for this instance to that of the passed instance. |
|
3530 |
+ * |
|
3531 |
+ * @param \Carbon\Carbon|\DateTimeInterface $date now if null |
|
3532 |
+ * |
|
3533 |
+ * @return static |
|
3534 |
+ */ |
|
3535 |
+ public function setTimeFrom($date = null); |
|
3536 |
+ |
|
3537 |
+ /** |
|
3538 |
+ * Set the time by time string. |
|
3539 |
+ * |
|
3540 |
+ * @param string $time |
|
3541 |
+ * |
|
3542 |
+ * @return static |
|
3543 |
+ */ |
|
3544 |
+ public function setTimeFromTimeString($time); |
|
3545 |
+ |
|
3546 |
+ /** |
|
3547 |
+ * call \DateTime::setTimestamp if mutable or \DateTimeImmutable::setTimestamp else. |
|
3548 |
+ * |
|
3549 |
+ * @see https://php.net/manual/en/datetime.settimestamp.php |
|
3550 |
+ */ |
|
3551 |
+ public function setTimestamp($unixtimestamp); |
|
3552 |
+ |
|
3553 |
+ /** |
|
3554 |
+ * Set the instance's timezone from a string or object. |
|
3555 |
+ * |
|
3556 |
+ * @param \DateTimeZone|string $value |
|
3557 |
+ * |
|
3558 |
+ * @return static |
|
3559 |
+ */ |
|
3560 |
+ public function setTimezone($value); |
|
3561 |
+ |
|
3562 |
+ /** |
|
3563 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3564 |
+ * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and |
|
3565 |
+ * use other method or custom format passed to format() method if you need to dump an other string |
|
3566 |
+ * format. |
|
3567 |
+ * |
|
3568 |
+ * Set the default format used when type juggling a Carbon instance to a string |
|
3569 |
+ * |
|
3570 |
+ * @param string|Closure|null $format |
|
3571 |
+ * |
|
3572 |
+ * @return void |
|
3573 |
+ */ |
|
3574 |
+ public static function setToStringFormat($format); |
|
3575 |
+ |
|
3576 |
+ /** |
|
3577 |
+ * Set the default translator instance to use. |
|
3578 |
+ * |
|
3579 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
3580 |
+ * |
|
3581 |
+ * @return void |
|
3582 |
+ */ |
|
3583 |
+ public static function setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator); |
|
3584 |
+ |
|
3585 |
+ /** |
|
3586 |
+ * Set specified unit to new given value. |
|
3587 |
+ * |
|
3588 |
+ * @param string $unit year, month, day, hour, minute, second or microsecond |
|
3589 |
+ * @param int $value new value for given unit |
|
3590 |
+ * |
|
3591 |
+ * @return static |
|
3592 |
+ */ |
|
3593 |
+ public function setUnit($unit, $value = null); |
|
3594 |
+ |
|
3595 |
+ /** |
|
3596 |
+ * Set any unit to a new value without overflowing current other unit given. |
|
3597 |
+ * |
|
3598 |
+ * @param string $valueUnit unit name to modify |
|
3599 |
+ * @param int $value new value for the input unit |
|
3600 |
+ * @param string $overflowUnit unit name to not overflow |
|
3601 |
+ * |
|
3602 |
+ * @return static |
|
3603 |
+ */ |
|
3604 |
+ public function setUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
3605 |
+ |
|
3606 |
+ /** |
|
3607 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3608 |
+ * You should rather use UTF-8 language packages on every machine. |
|
3609 |
+ * |
|
3610 |
+ * Set if UTF8 will be used for localized date/time. |
|
3611 |
+ * |
|
3612 |
+ * @param bool $utf8 |
|
3613 |
+ */ |
|
3614 |
+ public static function setUtf8($utf8); |
|
3615 |
+ |
|
3616 |
+ /** |
|
3617 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3618 |
+ * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek |
|
3619 |
+ * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the |
|
3620 |
+ * start of week according to current locale selected and implicitly the end of week. |
|
3621 |
+ * |
|
3622 |
+ * Set the last day of week |
|
3623 |
+ * |
|
3624 |
+ * @param int $day |
|
3625 |
+ * |
|
3626 |
+ * @return void |
|
3627 |
+ */ |
|
3628 |
+ public static function setWeekEndsAt($day); |
|
3629 |
+ |
|
3630 |
+ /** |
|
3631 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3632 |
+ * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the |
|
3633 |
+ * 'first_day_of_week' locale setting to change the start of week according to current locale |
|
3634 |
+ * selected and implicitly the end of week. |
|
3635 |
+ * |
|
3636 |
+ * Set the first day of week |
|
3637 |
+ * |
|
3638 |
+ * @param int $day week start day |
|
3639 |
+ * |
|
3640 |
+ * @return void |
|
3641 |
+ */ |
|
3642 |
+ public static function setWeekStartsAt($day); |
|
3643 |
+ |
|
3644 |
+ /** |
|
3645 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
3646 |
+ * You should rather consider week-end is always saturday and sunday, and if you have some custom |
|
3647 |
+ * week-end days to handle, give to those days an other name and create a macro for them: |
|
3648 |
+ * |
|
3649 |
+ * ``` |
|
3650 |
+ * Carbon::macro('isDayOff', function ($date) { |
|
3651 |
+ * return $date->isSunday() || $date->isMonday(); |
|
3652 |
+ * }); |
|
3653 |
+ * Carbon::macro('isNotDayOff', function ($date) { |
|
3654 |
+ * return !$date->isDayOff(); |
|
3655 |
+ * }); |
|
3656 |
+ * if ($someDate->isDayOff()) ... |
|
3657 |
+ * if ($someDate->isNotDayOff()) ... |
|
3658 |
+ * // Add 5 not-off days |
|
3659 |
+ * $count = 5; |
|
3660 |
+ * while ($someDate->isDayOff() || ($count-- > 0)) { |
|
3661 |
+ * $someDate->addDay(); |
|
3662 |
+ * } |
|
3663 |
+ * ``` |
|
3664 |
+ * |
|
3665 |
+ * Set weekend days |
|
3666 |
+ * |
|
3667 |
+ * @param array $days |
|
3668 |
+ * |
|
3669 |
+ * @return void |
|
3670 |
+ */ |
|
3671 |
+ public static function setWeekendDays($days); |
|
3672 |
+ |
|
3673 |
+ /** |
|
3674 |
+ * Set specific options. |
|
3675 |
+ * - strictMode: true|false|null |
|
3676 |
+ * - monthOverflow: true|false|null |
|
3677 |
+ * - yearOverflow: true|false|null |
|
3678 |
+ * - humanDiffOptions: int|null |
|
3679 |
+ * - toStringFormat: string|Closure|null |
|
3680 |
+ * - toJsonFormat: string|Closure|null |
|
3681 |
+ * - locale: string|null |
|
3682 |
+ * - timezone: \DateTimeZone|string|int|null |
|
3683 |
+ * - macros: array|null |
|
3684 |
+ * - genericMacros: array|null |
|
3685 |
+ * |
|
3686 |
+ * @param array $settings |
|
3687 |
+ * |
|
3688 |
+ * @return $this|static |
|
3689 |
+ */ |
|
3690 |
+ public function settings(array $settings); |
|
3691 |
+ |
|
3692 |
+ /** |
|
3693 |
+ * Set the instance's timezone from a string or object and add/subtract the offset difference. |
|
3694 |
+ * |
|
3695 |
+ * @param \DateTimeZone|string $value |
|
3696 |
+ * |
|
3697 |
+ * @return static |
|
3698 |
+ */ |
|
3699 |
+ public function shiftTimezone($value); |
|
3700 |
+ |
|
3701 |
+ /** |
|
3702 |
+ * Get the month overflow global behavior (can be overridden in specific instances). |
|
3703 |
+ * |
|
3704 |
+ * @return bool |
|
3705 |
+ */ |
|
3706 |
+ public static function shouldOverflowMonths(); |
|
3707 |
+ |
|
3708 |
+ /** |
|
3709 |
+ * Get the month overflow global behavior (can be overridden in specific instances). |
|
3710 |
+ * |
|
3711 |
+ * @return bool |
|
3712 |
+ */ |
|
3713 |
+ public static function shouldOverflowYears(); |
|
3714 |
+ |
|
3715 |
+ /** |
|
3716 |
+ * @alias diffForHumans |
|
3717 |
+ * |
|
3718 |
+ * Get the difference in a human readable format in the current locale from current instance to an other |
|
3719 |
+ * instance given (or now if null given). |
|
3720 |
+ */ |
|
3721 |
+ public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
3722 |
+ |
|
3723 |
+ /** |
|
3724 |
+ * Returns standardized singular of a given singular/plural unit name (in English). |
|
3725 |
+ * |
|
3726 |
+ * @param string $unit |
|
3727 |
+ * |
|
3728 |
+ * @return string |
|
3729 |
+ */ |
|
3730 |
+ public static function singularUnit(string $unit): string; |
|
3731 |
+ |
|
3732 |
+ /** |
|
3733 |
+ * Modify to start of current given unit. |
|
3734 |
+ * |
|
3735 |
+ * @example |
|
3736 |
+ * ``` |
|
3737 |
+ * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
3738 |
+ * ->startOf('month') |
|
3739 |
+ * ->endOf('week', Carbon::FRIDAY); |
|
3740 |
+ * ``` |
|
3741 |
+ * |
|
3742 |
+ * @param string $unit |
|
3743 |
+ * @param array<int, mixed> $params |
|
3744 |
+ * |
|
3745 |
+ * @return static |
|
3746 |
+ */ |
|
3747 |
+ public function startOf($unit, ...$params); |
|
3748 |
+ |
|
3749 |
+ /** |
|
3750 |
+ * Resets the date to the first day of the century and the time to 00:00:00 |
|
3751 |
+ * |
|
3752 |
+ * @example |
|
3753 |
+ * ``` |
|
3754 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury(); |
|
3755 |
+ * ``` |
|
3756 |
+ * |
|
3757 |
+ * @return static |
|
3758 |
+ */ |
|
3759 |
+ public function startOfCentury(); |
|
3760 |
+ |
|
3761 |
+ /** |
|
3762 |
+ * Resets the time to 00:00:00 start of day |
|
3763 |
+ * |
|
3764 |
+ * @example |
|
3765 |
+ * ``` |
|
3766 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfDay(); |
|
3767 |
+ * ``` |
|
3768 |
+ * |
|
3769 |
+ * @return static |
|
3770 |
+ */ |
|
3771 |
+ public function startOfDay(); |
|
3772 |
+ |
|
3773 |
+ /** |
|
3774 |
+ * Resets the date to the first day of the decade and the time to 00:00:00 |
|
3775 |
+ * |
|
3776 |
+ * @example |
|
3777 |
+ * ``` |
|
3778 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade(); |
|
3779 |
+ * ``` |
|
3780 |
+ * |
|
3781 |
+ * @return static |
|
3782 |
+ */ |
|
3783 |
+ public function startOfDecade(); |
|
3784 |
+ |
|
3785 |
+ /** |
|
3786 |
+ * Modify to start of current hour, minutes and seconds become 0 |
|
3787 |
+ * |
|
3788 |
+ * @example |
|
3789 |
+ * ``` |
|
3790 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfHour(); |
|
3791 |
+ * ``` |
|
3792 |
+ * |
|
3793 |
+ * @return static |
|
3794 |
+ */ |
|
3795 |
+ public function startOfHour(); |
|
3796 |
+ |
|
3797 |
+ /** |
|
3798 |
+ * Resets the date to the first day of the century and the time to 00:00:00 |
|
3799 |
+ * |
|
3800 |
+ * @example |
|
3801 |
+ * ``` |
|
3802 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium(); |
|
3803 |
+ * ``` |
|
3804 |
+ * |
|
3805 |
+ * @return static |
|
3806 |
+ */ |
|
3807 |
+ public function startOfMillennium(); |
|
3808 |
+ |
|
3809 |
+ /** |
|
3810 |
+ * Modify to start of current minute, seconds become 0 |
|
3811 |
+ * |
|
3812 |
+ * @example |
|
3813 |
+ * ``` |
|
3814 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute(); |
|
3815 |
+ * ``` |
|
3816 |
+ * |
|
3817 |
+ * @return static |
|
3818 |
+ */ |
|
3819 |
+ public function startOfMinute(); |
|
3820 |
+ |
|
3821 |
+ /** |
|
3822 |
+ * Resets the date to the first day of the month and the time to 00:00:00 |
|
3823 |
+ * |
|
3824 |
+ * @example |
|
3825 |
+ * ``` |
|
3826 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth(); |
|
3827 |
+ * ``` |
|
3828 |
+ * |
|
3829 |
+ * @return static |
|
3830 |
+ */ |
|
3831 |
+ public function startOfMonth(); |
|
3832 |
+ |
|
3833 |
+ /** |
|
3834 |
+ * Resets the date to the first day of the quarter and the time to 00:00:00 |
|
3835 |
+ * |
|
3836 |
+ * @example |
|
3837 |
+ * ``` |
|
3838 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter(); |
|
3839 |
+ * ``` |
|
3840 |
+ * |
|
3841 |
+ * @return static |
|
3842 |
+ */ |
|
3843 |
+ public function startOfQuarter(); |
|
3844 |
+ |
|
3845 |
+ /** |
|
3846 |
+ * Modify to start of current second, microseconds become 0 |
|
3847 |
+ * |
|
3848 |
+ * @example |
|
3849 |
+ * ``` |
|
3850 |
+ * echo Carbon::parse('2018-07-25 12:45:16.334455') |
|
3851 |
+ * ->startOfSecond() |
|
3852 |
+ * ->format('H:i:s.u'); |
|
3853 |
+ * ``` |
|
3854 |
+ * |
|
3855 |
+ * @return static |
|
3856 |
+ */ |
|
3857 |
+ public function startOfSecond(); |
|
3858 |
+ |
|
3859 |
+ /** |
|
3860 |
+ * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 |
|
3861 |
+ * |
|
3862 |
+ * @example |
|
3863 |
+ * ``` |
|
3864 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n"; |
|
3865 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n"; |
|
3866 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n"; |
|
3867 |
+ * ``` |
|
3868 |
+ * |
|
3869 |
+ * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week |
|
3870 |
+ * |
|
3871 |
+ * @return static |
|
3872 |
+ */ |
|
3873 |
+ public function startOfWeek($weekStartsAt = null); |
|
3874 |
+ |
|
3875 |
+ /** |
|
3876 |
+ * Resets the date to the first day of the year and the time to 00:00:00 |
|
3877 |
+ * |
|
3878 |
+ * @example |
|
3879 |
+ * ``` |
|
3880 |
+ * echo Carbon::parse('2018-07-25 12:45:16')->startOfYear(); |
|
3881 |
+ * ``` |
|
3882 |
+ * |
|
3883 |
+ * @return static |
|
3884 |
+ */ |
|
3885 |
+ public function startOfYear(); |
|
3886 |
+ |
|
3887 |
+ /** |
|
3888 |
+ * Subtract given units or interval to the current instance. |
|
3889 |
+ * |
|
3890 |
+ * @example $date->sub('hour', 3) |
|
3891 |
+ * @example $date->sub(15, 'days') |
|
3892 |
+ * @example $date->sub(CarbonInterval::days(4)) |
|
3893 |
+ * |
|
3894 |
+ * @param string|DateInterval $unit |
|
3895 |
+ * @param int $value |
|
3896 |
+ * @param bool|null $overflow |
|
3897 |
+ * |
|
3898 |
+ * @return CarbonInterface |
|
3899 |
+ */ |
|
3900 |
+ public function sub($unit, $value = 1, $overflow = null); |
|
3901 |
+ |
|
3902 |
+ public function subRealUnit($unit, $value = 1); |
|
3903 |
+ |
|
3904 |
+ /** |
|
3905 |
+ * Subtract given units to the current instance. |
|
3906 |
+ * |
|
3907 |
+ * @param string $unit |
|
3908 |
+ * @param int $value |
|
3909 |
+ * @param bool|null $overflow |
|
3910 |
+ * |
|
3911 |
+ * @return CarbonInterface |
|
3912 |
+ */ |
|
3913 |
+ public function subUnit($unit, $value = 1, $overflow = null); |
|
3914 |
+ |
|
3915 |
+ /** |
|
3916 |
+ * Subtract any unit to a new value without overflowing current other unit given. |
|
3917 |
+ * |
|
3918 |
+ * @param string $valueUnit unit name to modify |
|
3919 |
+ * @param int $value amount to subtract to the input unit |
|
3920 |
+ * @param string $overflowUnit unit name to not overflow |
|
3921 |
+ * |
|
3922 |
+ * @return static |
|
3923 |
+ */ |
|
3924 |
+ public function subUnitNoOverflow($valueUnit, $value, $overflowUnit); |
|
3925 |
+ |
|
3926 |
+ /** |
|
3927 |
+ * Subtract given units or interval to the current instance. |
|
3928 |
+ * |
|
3929 |
+ * @see sub() |
|
3930 |
+ * |
|
3931 |
+ * @param string|DateInterval $unit |
|
3932 |
+ * @param int $value |
|
3933 |
+ * @param bool|null $overflow |
|
3934 |
+ * |
|
3935 |
+ * @return CarbonInterface |
|
3936 |
+ */ |
|
3937 |
+ public function subtract($unit, $value = 1, $overflow = null); |
|
3938 |
+ |
|
3939 |
+ /** |
|
3940 |
+ * Get the difference in a human readable format in the current locale from current instance to an other |
|
3941 |
+ * instance given (or now if null given). |
|
3942 |
+ * |
|
3943 |
+ * @return string |
|
3944 |
+ */ |
|
3945 |
+ public function timespan($other = null, $timezone = null); |
|
3946 |
+ |
|
3947 |
+ /** |
|
3948 |
+ * Set the instance's timestamp. |
|
3949 |
+ * |
|
3950 |
+ * @param int $value |
|
3951 |
+ * |
|
3952 |
+ * @return static |
|
3953 |
+ */ |
|
3954 |
+ public function timestamp($value); |
|
3955 |
+ |
|
3956 |
+ /** |
|
3957 |
+ * @alias setTimezone |
|
3958 |
+ * |
|
3959 |
+ * @param \DateTimeZone|string $value |
|
3960 |
+ * |
|
3961 |
+ * @return static |
|
3962 |
+ */ |
|
3963 |
+ public function timezone($value); |
|
3964 |
+ |
|
3965 |
+ /** |
|
3966 |
+ * Get the difference in a human readable format in the current locale from an other |
|
3967 |
+ * instance given (or now if null given) to current instance. |
|
3968 |
+ * |
|
3969 |
+ * When comparing a value in the past to default now: |
|
3970 |
+ * 1 hour from now |
|
3971 |
+ * 5 months from now |
|
3972 |
+ * |
|
3973 |
+ * When comparing a value in the future to default now: |
|
3974 |
+ * 1 hour ago |
|
3975 |
+ * 5 months ago |
|
3976 |
+ * |
|
3977 |
+ * When comparing a value in the past to another value: |
|
3978 |
+ * 1 hour after |
|
3979 |
+ * 5 months after |
|
3980 |
+ * |
|
3981 |
+ * When comparing a value in the future to another value: |
|
3982 |
+ * 1 hour before |
|
3983 |
+ * 5 months before |
|
3984 |
+ * |
|
3985 |
+ * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
3986 |
+ * if null passed, now will be used as comparison reference; |
|
3987 |
+ * if any other type, it will be converted to date and used as reference. |
|
3988 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
3989 |
+ * - 'syntax' entry (see below) |
|
3990 |
+ * - 'short' entry (see below) |
|
3991 |
+ * - 'parts' entry (see below) |
|
3992 |
+ * - 'options' entry (see below) |
|
3993 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
3994 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
3995 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
3996 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
3997 |
+ * ` will be used instead of the glue for the last item |
|
3998 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
3999 |
+ * ` - if $join is missing, a space will be used as glue |
|
4000 |
+ * - 'other' entry (see above) |
|
4001 |
+ * if int passed, it add modifiers: |
|
4002 |
+ * Possible values: |
|
4003 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4004 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4005 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4006 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4007 |
+ * @param bool $short displays short format of time units |
|
4008 |
+ * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
4009 |
+ * @param int $options human diff options |
|
4010 |
+ * |
|
4011 |
+ * @return string |
|
4012 |
+ */ |
|
4013 |
+ public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
4014 |
+ |
|
4015 |
+ /** |
|
4016 |
+ * Get default array representation. |
|
4017 |
+ * |
|
4018 |
+ * @example |
|
4019 |
+ * ``` |
|
4020 |
+ * var_dump(Carbon::now()->toArray()); |
|
4021 |
+ * ``` |
|
4022 |
+ * |
|
4023 |
+ * @return array |
|
4024 |
+ */ |
|
4025 |
+ public function toArray(); |
|
4026 |
+ |
|
4027 |
+ /** |
|
4028 |
+ * Format the instance as ATOM |
|
4029 |
+ * |
|
4030 |
+ * @example |
|
4031 |
+ * ``` |
|
4032 |
+ * echo Carbon::now()->toAtomString(); |
|
4033 |
+ * ``` |
|
4034 |
+ * |
|
4035 |
+ * @return string |
|
4036 |
+ */ |
|
4037 |
+ public function toAtomString(); |
|
4038 |
+ |
|
4039 |
+ /** |
|
4040 |
+ * Format the instance as COOKIE |
|
4041 |
+ * |
|
4042 |
+ * @example |
|
4043 |
+ * ``` |
|
4044 |
+ * echo Carbon::now()->toCookieString(); |
|
4045 |
+ * ``` |
|
4046 |
+ * |
|
4047 |
+ * @return string |
|
4048 |
+ */ |
|
4049 |
+ public function toCookieString(); |
|
4050 |
+ |
|
4051 |
+ /** |
|
4052 |
+ * @alias toDateTime |
|
4053 |
+ * |
|
4054 |
+ * Return native DateTime PHP object matching the current instance. |
|
4055 |
+ * |
|
4056 |
+ * @example |
|
4057 |
+ * ``` |
|
4058 |
+ * var_dump(Carbon::now()->toDate()); |
|
4059 |
+ * ``` |
|
4060 |
+ * |
|
4061 |
+ * @return DateTime |
|
4062 |
+ */ |
|
4063 |
+ public function toDate(); |
|
4064 |
+ |
|
4065 |
+ /** |
|
4066 |
+ * Format the instance as date |
|
4067 |
+ * |
|
4068 |
+ * @example |
|
4069 |
+ * ``` |
|
4070 |
+ * echo Carbon::now()->toDateString(); |
|
4071 |
+ * ``` |
|
4072 |
+ * |
|
4073 |
+ * @return string |
|
4074 |
+ */ |
|
4075 |
+ public function toDateString(); |
|
4076 |
+ |
|
4077 |
+ /** |
|
4078 |
+ * Return native DateTime PHP object matching the current instance. |
|
4079 |
+ * |
|
4080 |
+ * @example |
|
4081 |
+ * ``` |
|
4082 |
+ * var_dump(Carbon::now()->toDateTime()); |
|
4083 |
+ * ``` |
|
4084 |
+ * |
|
4085 |
+ * @return DateTime |
|
4086 |
+ */ |
|
4087 |
+ public function toDateTime(); |
|
4088 |
+ |
|
4089 |
+ /** |
|
4090 |
+ * Format the instance as date and time T-separated with no timezone |
|
4091 |
+ * |
|
4092 |
+ * @example |
|
4093 |
+ * ``` |
|
4094 |
+ * echo Carbon::now()->toDateTimeLocalString(); |
|
4095 |
+ * ``` |
|
4096 |
+ * |
|
4097 |
+ * @return string |
|
4098 |
+ */ |
|
4099 |
+ public function toDateTimeLocalString(); |
|
4100 |
+ |
|
4101 |
+ /** |
|
4102 |
+ * Format the instance as date and time |
|
4103 |
+ * |
|
4104 |
+ * @example |
|
4105 |
+ * ``` |
|
4106 |
+ * echo Carbon::now()->toDateTimeString(); |
|
4107 |
+ * ``` |
|
4108 |
+ * |
|
4109 |
+ * @return string |
|
4110 |
+ */ |
|
4111 |
+ public function toDateTimeString(); |
|
4112 |
+ |
|
4113 |
+ /** |
|
4114 |
+ * Format the instance with day, date and time |
|
4115 |
+ * |
|
4116 |
+ * @example |
|
4117 |
+ * ``` |
|
4118 |
+ * echo Carbon::now()->toDayDateTimeString(); |
|
4119 |
+ * ``` |
|
4120 |
+ * |
|
4121 |
+ * @return string |
|
4122 |
+ */ |
|
4123 |
+ public function toDayDateTimeString(); |
|
4124 |
+ |
|
4125 |
+ /** |
|
4126 |
+ * Format the instance as a readable date |
|
4127 |
+ * |
|
4128 |
+ * @example |
|
4129 |
+ * ``` |
|
4130 |
+ * echo Carbon::now()->toFormattedDateString(); |
|
4131 |
+ * ``` |
|
4132 |
+ * |
|
4133 |
+ * @return string |
|
4134 |
+ */ |
|
4135 |
+ public function toFormattedDateString(); |
|
4136 |
+ |
|
4137 |
+ /** |
|
4138 |
+ * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: |
|
4139 |
+ * 1977-04-22T01:00:00-05:00). |
|
4140 |
+ * |
|
4141 |
+ * @example |
|
4142 |
+ * ``` |
|
4143 |
+ * echo Carbon::now('America/Toronto')->toISOString() . "\n"; |
|
4144 |
+ * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; |
|
4145 |
+ * ``` |
|
4146 |
+ * |
|
4147 |
+ * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. |
|
4148 |
+ * |
|
4149 |
+ * @return null|string |
|
4150 |
+ */ |
|
4151 |
+ public function toISOString($keepOffset = false); |
|
4152 |
+ |
|
4153 |
+ /** |
|
4154 |
+ * Return a immutable copy of the instance. |
|
4155 |
+ * |
|
4156 |
+ * @return CarbonImmutable |
|
4157 |
+ */ |
|
4158 |
+ public function toImmutable(); |
|
4159 |
+ |
|
4160 |
+ /** |
|
4161 |
+ * Format the instance as ISO8601 |
|
4162 |
+ * |
|
4163 |
+ * @example |
|
4164 |
+ * ``` |
|
4165 |
+ * echo Carbon::now()->toIso8601String(); |
|
4166 |
+ * ``` |
|
4167 |
+ * |
|
4168 |
+ * @return string |
|
4169 |
+ */ |
|
4170 |
+ public function toIso8601String(); |
|
4171 |
+ |
|
4172 |
+ /** |
|
4173 |
+ * Convert the instance to UTC and return as Zulu ISO8601 |
|
4174 |
+ * |
|
4175 |
+ * @example |
|
4176 |
+ * ``` |
|
4177 |
+ * echo Carbon::now()->toIso8601ZuluString(); |
|
4178 |
+ * ``` |
|
4179 |
+ * |
|
4180 |
+ * @return string |
|
4181 |
+ */ |
|
4182 |
+ public function toIso8601ZuluString(); |
|
4183 |
+ |
|
4184 |
+ /** |
|
4185 |
+ * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. |
|
4186 |
+ * |
|
4187 |
+ * @example |
|
4188 |
+ * ``` |
|
4189 |
+ * echo Carbon::now('America/Toronto')->toJSON(); |
|
4190 |
+ * ``` |
|
4191 |
+ * |
|
4192 |
+ * @return null|string |
|
4193 |
+ */ |
|
4194 |
+ public function toJSON(); |
|
4195 |
+ |
|
4196 |
+ /** |
|
4197 |
+ * Return a mutable copy of the instance. |
|
4198 |
+ * |
|
4199 |
+ * @return Carbon |
|
4200 |
+ */ |
|
4201 |
+ public function toMutable(); |
|
4202 |
+ |
|
4203 |
+ /** |
|
4204 |
+ * Get the difference in a human readable format in the current locale from an other |
|
4205 |
+ * instance given to now |
|
4206 |
+ * |
|
4207 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
4208 |
+ * - 'syntax' entry (see below) |
|
4209 |
+ * - 'short' entry (see below) |
|
4210 |
+ * - 'parts' entry (see below) |
|
4211 |
+ * - 'options' entry (see below) |
|
4212 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
4213 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
4214 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
4215 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
4216 |
+ * ` will be used instead of the glue for the last item |
|
4217 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
4218 |
+ * ` - if $join is missing, a space will be used as glue |
|
4219 |
+ * if int passed, it add modifiers: |
|
4220 |
+ * Possible values: |
|
4221 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4222 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4223 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4224 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4225 |
+ * @param bool $short displays short format of time units |
|
4226 |
+ * @param int $parts maximum number of parts to display (default value: 1: single part) |
|
4227 |
+ * @param int $options human diff options |
|
4228 |
+ * |
|
4229 |
+ * @return string |
|
4230 |
+ */ |
|
4231 |
+ public function toNow($syntax = null, $short = false, $parts = 1, $options = null); |
|
4232 |
+ |
|
4233 |
+ /** |
|
4234 |
+ * Get default object representation. |
|
4235 |
+ * |
|
4236 |
+ * @example |
|
4237 |
+ * ``` |
|
4238 |
+ * var_dump(Carbon::now()->toObject()); |
|
4239 |
+ * ``` |
|
4240 |
+ * |
|
4241 |
+ * @return object |
|
4242 |
+ */ |
|
4243 |
+ public function toObject(); |
|
4244 |
+ |
|
4245 |
+ /** |
|
4246 |
+ * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). |
|
4247 |
+ * |
|
4248 |
+ * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date |
|
4249 |
+ * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit |
|
4250 |
+ * @param string|null $unit if specified, $interval must be an integer |
|
4251 |
+ * |
|
4252 |
+ * @return CarbonPeriod |
|
4253 |
+ */ |
|
4254 |
+ public function toPeriod($end = null, $interval = null, $unit = null); |
|
4255 |
+ |
|
4256 |
+ /** |
|
4257 |
+ * Format the instance as RFC1036 |
|
4258 |
+ * |
|
4259 |
+ * @example |
|
4260 |
+ * ``` |
|
4261 |
+ * echo Carbon::now()->toRfc1036String(); |
|
4262 |
+ * ``` |
|
4263 |
+ * |
|
4264 |
+ * @return string |
|
4265 |
+ */ |
|
4266 |
+ public function toRfc1036String(); |
|
4267 |
+ |
|
4268 |
+ /** |
|
4269 |
+ * Format the instance as RFC1123 |
|
4270 |
+ * |
|
4271 |
+ * @example |
|
4272 |
+ * ``` |
|
4273 |
+ * echo Carbon::now()->toRfc1123String(); |
|
4274 |
+ * ``` |
|
4275 |
+ * |
|
4276 |
+ * @return string |
|
4277 |
+ */ |
|
4278 |
+ public function toRfc1123String(); |
|
4279 |
+ |
|
4280 |
+ /** |
|
4281 |
+ * Format the instance as RFC2822 |
|
4282 |
+ * |
|
4283 |
+ * @example |
|
4284 |
+ * ``` |
|
4285 |
+ * echo Carbon::now()->toRfc2822String(); |
|
4286 |
+ * ``` |
|
4287 |
+ * |
|
4288 |
+ * @return string |
|
4289 |
+ */ |
|
4290 |
+ public function toRfc2822String(); |
|
4291 |
+ |
|
4292 |
+ /** |
|
4293 |
+ * Format the instance as RFC3339 |
|
4294 |
+ * |
|
4295 |
+ * @example |
|
4296 |
+ * ``` |
|
4297 |
+ * echo Carbon::now()->toRfc3339String(); |
|
4298 |
+ * ``` |
|
4299 |
+ * |
|
4300 |
+ * @return string |
|
4301 |
+ */ |
|
4302 |
+ public function toRfc3339String(); |
|
4303 |
+ |
|
4304 |
+ /** |
|
4305 |
+ * Format the instance as RFC7231 |
|
4306 |
+ * |
|
4307 |
+ * @example |
|
4308 |
+ * ``` |
|
4309 |
+ * echo Carbon::now()->toRfc7231String(); |
|
4310 |
+ * ``` |
|
4311 |
+ * |
|
4312 |
+ * @return string |
|
4313 |
+ */ |
|
4314 |
+ public function toRfc7231String(); |
|
4315 |
+ |
|
4316 |
+ /** |
|
4317 |
+ * Format the instance as RFC822 |
|
4318 |
+ * |
|
4319 |
+ * @example |
|
4320 |
+ * ``` |
|
4321 |
+ * echo Carbon::now()->toRfc822String(); |
|
4322 |
+ * ``` |
|
4323 |
+ * |
|
4324 |
+ * @return string |
|
4325 |
+ */ |
|
4326 |
+ public function toRfc822String(); |
|
4327 |
+ |
|
4328 |
+ /** |
|
4329 |
+ * Format the instance as RFC850 |
|
4330 |
+ * |
|
4331 |
+ * @example |
|
4332 |
+ * ``` |
|
4333 |
+ * echo Carbon::now()->toRfc850String(); |
|
4334 |
+ * ``` |
|
4335 |
+ * |
|
4336 |
+ * @return string |
|
4337 |
+ */ |
|
4338 |
+ public function toRfc850String(); |
|
4339 |
+ |
|
4340 |
+ /** |
|
4341 |
+ * Format the instance as RSS |
|
4342 |
+ * |
|
4343 |
+ * @example |
|
4344 |
+ * ``` |
|
4345 |
+ * echo Carbon::now()->toRssString(); |
|
4346 |
+ * ``` |
|
4347 |
+ * |
|
4348 |
+ * @return string |
|
4349 |
+ */ |
|
4350 |
+ public function toRssString(); |
|
4351 |
+ |
|
4352 |
+ /** |
|
4353 |
+ * Returns english human readable complete date string. |
|
4354 |
+ * |
|
4355 |
+ * @example |
|
4356 |
+ * ``` |
|
4357 |
+ * echo Carbon::now()->toString(); |
|
4358 |
+ * ``` |
|
4359 |
+ * |
|
4360 |
+ * @return string |
|
4361 |
+ */ |
|
4362 |
+ public function toString(); |
|
4363 |
+ |
|
4364 |
+ /** |
|
4365 |
+ * Format the instance as time |
|
4366 |
+ * |
|
4367 |
+ * @example |
|
4368 |
+ * ``` |
|
4369 |
+ * echo Carbon::now()->toTimeString(); |
|
4370 |
+ * ``` |
|
4371 |
+ * |
|
4372 |
+ * @return string |
|
4373 |
+ */ |
|
4374 |
+ public function toTimeString(); |
|
4375 |
+ |
|
4376 |
+ /** |
|
4377 |
+ * Format the instance as W3C |
|
4378 |
+ * |
|
4379 |
+ * @example |
|
4380 |
+ * ``` |
|
4381 |
+ * echo Carbon::now()->toW3cString(); |
|
4382 |
+ * ``` |
|
4383 |
+ * |
|
4384 |
+ * @return string |
|
4385 |
+ */ |
|
4386 |
+ public function toW3cString(); |
|
4387 |
+ |
|
4388 |
+ /** |
|
4389 |
+ * Create a Carbon instance for today. |
|
4390 |
+ * |
|
4391 |
+ * @param \DateTimeZone|string|null $tz |
|
4392 |
+ * |
|
4393 |
+ * @return static |
|
4394 |
+ */ |
|
4395 |
+ public static function today($tz = null); |
|
4396 |
+ |
|
4397 |
+ /** |
|
4398 |
+ * Create a Carbon instance for tomorrow. |
|
4399 |
+ * |
|
4400 |
+ * @param \DateTimeZone|string|null $tz |
|
4401 |
+ * |
|
4402 |
+ * @return static |
|
4403 |
+ */ |
|
4404 |
+ public static function tomorrow($tz = null); |
|
4405 |
+ |
|
4406 |
+ /** |
|
4407 |
+ * Translate using translation string or callback available. |
|
4408 |
+ * |
|
4409 |
+ * @param string $key |
|
4410 |
+ * @param array $parameters |
|
4411 |
+ * @param null $number |
|
4412 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
4413 |
+ * |
|
4414 |
+ * @return string |
|
4415 |
+ */ |
|
4416 |
+ public function translate(string $key, array $parameters = [], $number = null, \Symfony\Component\Translation\TranslatorInterface $translator = null): string; |
|
4417 |
+ |
|
4418 |
+ /** |
|
4419 |
+ * Translate a time string from a locale to an other. |
|
4420 |
+ * |
|
4421 |
+ * @param string $timeString time string to translate |
|
4422 |
+ * @param string|null $from input locale of the $timeString parameter (`Carbon::getLocale()` by default) |
|
4423 |
+ * @param string|null $to output locale of the result returned (`"en"` by default) |
|
4424 |
+ * @param int $mode specify what to translate with options: |
|
4425 |
+ * - CarbonInterface::TRANSLATE_ALL (default) |
|
4426 |
+ * - CarbonInterface::TRANSLATE_MONTHS |
|
4427 |
+ * - CarbonInterface::TRANSLATE_DAYS |
|
4428 |
+ * - CarbonInterface::TRANSLATE_UNITS |
|
4429 |
+ * - CarbonInterface::TRANSLATE_MERIDIEM |
|
4430 |
+ * You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS |
|
4431 |
+ * |
|
4432 |
+ * @return string |
|
4433 |
+ */ |
|
4434 |
+ public static function translateTimeString($timeString, $from = null, $to = null, $mode = 15); |
|
4435 |
+ |
|
4436 |
+ /** |
|
4437 |
+ * Translate a time string from the current locale (`$date->locale()`) to an other. |
|
4438 |
+ * |
|
4439 |
+ * @param string $timeString time string to translate |
|
4440 |
+ * @param string|null $to output locale of the result returned ("en" by default) |
|
4441 |
+ * |
|
4442 |
+ * @return string |
|
4443 |
+ */ |
|
4444 |
+ public function translateTimeStringTo($timeString, $to = null); |
|
4445 |
+ |
|
4446 |
+ /** |
|
4447 |
+ * Translate using translation string or callback available. |
|
4448 |
+ * |
|
4449 |
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator |
|
4450 |
+ * @param string $key |
|
4451 |
+ * @param array $parameters |
|
4452 |
+ * @param null $number |
|
4453 |
+ * |
|
4454 |
+ * @return string |
|
4455 |
+ */ |
|
4456 |
+ public static function translateWith(\Symfony\Component\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null): string; |
|
4457 |
+ |
|
4458 |
+ /** |
|
4459 |
+ * Format as ->format() do (using date replacements patterns from http://php.net/manual/fr/function.date.php) |
|
4460 |
+ * but translate words whenever possible (months, day names, etc.) using the current locale. |
|
4461 |
+ * |
|
4462 |
+ * @param string $format |
|
4463 |
+ * |
|
4464 |
+ * @return string |
|
4465 |
+ */ |
|
4466 |
+ public function translatedFormat(string $format): string; |
|
4467 |
+ |
|
4468 |
+ /** |
|
4469 |
+ * Set the timezone or returns the timezone name if no arguments passed. |
|
4470 |
+ * |
|
4471 |
+ * @param \DateTimeZone|string $value |
|
4472 |
+ * |
|
4473 |
+ * @return static|string |
|
4474 |
+ */ |
|
4475 |
+ public function tz($value = null); |
|
4476 |
+ |
|
4477 |
+ /** |
|
4478 |
+ * @alias getTimestamp |
|
4479 |
+ * |
|
4480 |
+ * Returns the UNIX timestamp for the current date. |
|
4481 |
+ * |
|
4482 |
+ * @return int |
|
4483 |
+ */ |
|
4484 |
+ public function unix(); |
|
4485 |
+ |
|
4486 |
+ /** |
|
4487 |
+ * @alias to |
|
4488 |
+ * |
|
4489 |
+ * Get the difference in a human readable format in the current locale from an other |
|
4490 |
+ * instance given (or now if null given) to current instance. |
|
4491 |
+ * |
|
4492 |
+ * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; |
|
4493 |
+ * if null passed, now will be used as comparison reference; |
|
4494 |
+ * if any other type, it will be converted to date and used as reference. |
|
4495 |
+ * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: |
|
4496 |
+ * - 'syntax' entry (see below) |
|
4497 |
+ * - 'short' entry (see below) |
|
4498 |
+ * - 'parts' entry (see below) |
|
4499 |
+ * - 'options' entry (see below) |
|
4500 |
+ * - 'join' entry determines how to join multiple parts of the string |
|
4501 |
+ * ` - if $join is a string, it's used as a joiner glue |
|
4502 |
+ * ` - if $join is a callable/closure, it get the list of string and should return a string |
|
4503 |
+ * ` - if $join is an array, the first item will be the default glue, and the second item |
|
4504 |
+ * ` will be used instead of the glue for the last item |
|
4505 |
+ * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) |
|
4506 |
+ * ` - if $join is missing, a space will be used as glue |
|
4507 |
+ * - 'other' entry (see above) |
|
4508 |
+ * if int passed, it add modifiers: |
|
4509 |
+ * Possible values: |
|
4510 |
+ * - CarbonInterface::DIFF_ABSOLUTE no modifiers |
|
4511 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier |
|
4512 |
+ * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier |
|
4513 |
+ * Default value: CarbonInterface::DIFF_ABSOLUTE |
|
4514 |
+ * @param bool $short displays short format of time units |
|
4515 |
+ * @param int $parts maximum number of parts to display (default value: 1: single unit) |
|
4516 |
+ * @param int $options human diff options |
|
4517 |
+ * |
|
4518 |
+ * @return string |
|
4519 |
+ */ |
|
4520 |
+ public function until($other = null, $syntax = null, $short = false, $parts = 1, $options = null); |
|
4521 |
+ |
|
4522 |
+ /** |
|
4523 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4524 |
+ * You should rather use the ->settings() method. |
|
4525 |
+ * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants |
|
4526 |
+ * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
4527 |
+ * @see settings |
|
4528 |
+ * |
|
4529 |
+ * Indicates if months should be calculated with overflow. |
|
4530 |
+ * |
|
4531 |
+ * @param bool $monthsOverflow |
|
4532 |
+ * |
|
4533 |
+ * @return void |
|
4534 |
+ */ |
|
4535 |
+ public static function useMonthsOverflow($monthsOverflow = true); |
|
4536 |
+ |
|
4537 |
+ /** |
|
4538 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4539 |
+ * You should rather use the ->settings() method. |
|
4540 |
+ * @see settings |
|
4541 |
+ * |
|
4542 |
+ * Enable the strict mode (or disable with passing false). |
|
4543 |
+ * |
|
4544 |
+ * @param bool $strictModeEnabled |
|
4545 |
+ */ |
|
4546 |
+ public static function useStrictMode($strictModeEnabled = true); |
|
4547 |
+ |
|
4548 |
+ /** |
|
4549 |
+ * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. |
|
4550 |
+ * You should rather use the ->settings() method. |
|
4551 |
+ * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants |
|
4552 |
+ * are available for quarters, years, decade, centuries, millennia (singular and plural forms). |
|
4553 |
+ * @see settings |
|
4554 |
+ * |
|
4555 |
+ * Indicates if years should be calculated with overflow. |
|
4556 |
+ * |
|
4557 |
+ * @param bool $yearsOverflow |
|
4558 |
+ * |
|
4559 |
+ * @return void |
|
4560 |
+ */ |
|
4561 |
+ public static function useYearsOverflow($yearsOverflow = true); |
|
4562 |
+ |
|
4563 |
+ /** |
|
4564 |
+ * Set the instance's timezone to UTC. |
|
4565 |
+ * |
|
4566 |
+ * @return static |
|
4567 |
+ */ |
|
4568 |
+ public function utc(); |
|
4569 |
+ |
|
4570 |
+ /** |
|
4571 |
+ * Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed. |
|
4572 |
+ * |
|
4573 |
+ * @param int|null $offset |
|
4574 |
+ * |
|
4575 |
+ * @return int|static |
|
4576 |
+ */ |
|
4577 |
+ public function utcOffset(int $offset = null); |
|
4578 |
+ |
|
4579 |
+ /** |
|
4580 |
+ * Returns the milliseconds timestamps used amongst other by Date javascript objects. |
|
4581 |
+ * |
|
4582 |
+ * @return float |
|
4583 |
+ */ |
|
4584 |
+ public function valueOf(); |
|
4585 |
+ |
|
4586 |
+ /** |
|
4587 |
+ * Get/set the week number using given first day of week and first |
|
4588 |
+ * day of year included in the first week. Or use US format if no settings |
|
4589 |
+ * given (Sunday / Jan 6). |
|
4590 |
+ * |
|
4591 |
+ * @param int|null $week |
|
4592 |
+ * @param int|null $dayOfWeek |
|
4593 |
+ * @param int|null $dayOfYear |
|
4594 |
+ * |
|
4595 |
+ * @return int|static |
|
4596 |
+ */ |
|
4597 |
+ public function week($week = null, $dayOfWeek = null, $dayOfYear = null); |
|
4598 |
+ |
|
4599 |
+ /** |
|
4600 |
+ * Set/get the week number of year using given first day of week and first |
|
4601 |
+ * day of year included in the first week. Or use US format if no settings |
|
4602 |
+ * given (Sunday / Jan 6). |
|
4603 |
+ * |
|
4604 |
+ * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. |
|
4605 |
+ * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
4606 |
+ * @param int|null $dayOfYear first day of year included in the week #1 |
|
4607 |
+ * |
|
4608 |
+ * @return int|static |
|
4609 |
+ */ |
|
4610 |
+ public function weekYear($year = null, $dayOfWeek = null, $dayOfYear = null); |
|
4611 |
+ |
|
4612 |
+ /** |
|
4613 |
+ * Get/set the weekday from 0 (Sunday) to 6 (Saturday). |
|
4614 |
+ * |
|
4615 |
+ * @param int|null $value new value for weekday if using as setter. |
|
4616 |
+ * |
|
4617 |
+ * @return static|int |
|
4618 |
+ */ |
|
4619 |
+ public function weekday($value = null); |
|
4620 |
+ |
|
4621 |
+ /** |
|
4622 |
+ * Get the number of weeks of the current week-year using given first day of week and first |
|
4623 |
+ * day of year included in the first week. Or use US format if no settings |
|
4624 |
+ * given (Sunday / Jan 6). |
|
4625 |
+ * |
|
4626 |
+ * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) |
|
4627 |
+ * @param int|null $dayOfYear first day of year included in the week #1 |
|
4628 |
+ * |
|
4629 |
+ * @return int |
|
4630 |
+ */ |
|
4631 |
+ public function weeksInYear($dayOfWeek = null, $dayOfYear = null); |
|
4632 |
+ |
|
4633 |
+ /** |
|
4634 |
+ * Create a Carbon instance for yesterday. |
|
4635 |
+ * |
|
4636 |
+ * @param \DateTimeZone|string|null $tz |
|
4637 |
+ * |
|
4638 |
+ * @return static |
|
4639 |
+ */ |
|
4640 |
+ public static function yesterday($tz = null); |
|
4641 |
+ |
|
4642 |
+ // </methods> |
|
4643 |
+} |