CarbonImmutable.php 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <?php
  2. /**
  3. * This file is part of the Carbon package.
  4. *
  5. * (c) Brian Nesbitt <brian@nesbot.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Carbon;
  11. use Carbon\Traits\Date;
  12. use DateTimeImmutable;
  13. use DateTimeInterface;
  14. use DateTimeZone;
  15. /**
  16. * A simple API extension for DateTimeImmutable.
  17. *
  18. * <autodoc generated by `composer phpdoc`>
  19. *
  20. * @property int $year
  21. * @property int $yearIso
  22. * @property int $month
  23. * @property int $day
  24. * @property int $hour
  25. * @property int $minute
  26. * @property int $second
  27. * @property int $micro
  28. * @property int $microsecond
  29. * @property int|float|string $timestamp seconds since the Unix Epoch
  30. * @property string $englishDayOfWeek the day of week in English
  31. * @property string $shortEnglishDayOfWeek the abbreviated day of week in English
  32. * @property string $englishMonth the month in English
  33. * @property string $shortEnglishMonth the abbreviated month in English
  34. * @property string $localeDayOfWeek the day of week in current locale LC_TIME
  35. * @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME
  36. * @property string $localeMonth the month in current locale LC_TIME
  37. * @property string $shortLocaleMonth the abbreviated month in current locale LC_TIME
  38. * @property int $milliseconds
  39. * @property int $millisecond
  40. * @property int $milli
  41. * @property int $week 1 through 53
  42. * @property int $isoWeek 1 through 53
  43. * @property int $weekYear year according to week format
  44. * @property int $isoWeekYear year according to ISO week format
  45. * @property int $dayOfYear 1 through 366
  46. * @property int $age does a diffInYears() with default parameters
  47. * @property int $offset the timezone offset in seconds from UTC
  48. * @property int $offsetMinutes the timezone offset in minutes from UTC
  49. * @property int $offsetHours the timezone offset in hours from UTC
  50. * @property CarbonTimeZone $timezone the current timezone
  51. * @property CarbonTimeZone $tz alias of $timezone
  52. * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday)
  53. * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday)
  54. * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday
  55. * @property-read int $daysInMonth number of days in the given month
  56. * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark)
  57. * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark)
  58. * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name
  59. * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName
  60. * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language
  61. * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language
  62. * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language
  63. * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language
  64. * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language
  65. * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
  66. * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
  67. * @property-read int $noZeroHour current hour from 1 to 24
  68. * @property-read int $weeksInYear 51 through 53
  69. * @property-read int $isoWeeksInYear 51 through 53
  70. * @property-read int $weekOfMonth 1 through 5
  71. * @property-read int $weekNumberInMonth 1 through 5
  72. * @property-read int $firstWeekDay 0 through 6
  73. * @property-read int $lastWeekDay 0 through 6
  74. * @property-read int $daysInYear 365 or 366
  75. * @property-read int $quarter the quarter of this instance, 1 - 4
  76. * @property-read int $decade the decade of this instance
  77. * @property-read int $century the century of this instance
  78. * @property-read int $millennium the millennium of this instance
  79. * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise
  80. * @property-read bool $local checks if the timezone is local, true if local, false otherwise
  81. * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise
  82. * @property-read string $timezoneName the current timezone name
  83. * @property-read string $tzName alias of $timezoneName
  84. * @property-read string $locale locale of the current instance
  85. *
  86. * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.)
  87. * @method bool isLocal() Check if the current instance has non-UTC timezone.
  88. * @method bool isValid() Check if the current instance is a valid date.
  89. * @method bool isDST() Check if the current instance is in a daylight saving time.
  90. * @method bool isSunday() Checks if the instance day is sunday.
  91. * @method bool isMonday() Checks if the instance day is monday.
  92. * @method bool isTuesday() Checks if the instance day is tuesday.
  93. * @method bool isWednesday() Checks if the instance day is wednesday.
  94. * @method bool isThursday() Checks if the instance day is thursday.
  95. * @method bool isFriday() Checks if the instance day is friday.
  96. * @method bool isSaturday() Checks if the instance day is saturday.
  97. * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone).
  98. * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment.
  99. * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year.
  100. * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year.
  101. * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone).
  102. * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment.
  103. * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week.
  104. * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week.
  105. * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone).
  106. * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment.
  107. * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day.
  108. * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day.
  109. * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone).
  110. * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment.
  111. * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour.
  112. * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour.
  113. * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone).
  114. * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment.
  115. * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute.
  116. * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute.
  117. * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone).
  118. * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment.
  119. * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second.
  120. * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second.
  121. * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
  122. * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment.
  123. * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond.
  124. * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond.
  125. * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
  126. * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment.
  127. * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond.
  128. * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond.
  129. * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment.
  130. * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month.
  131. * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month.
  132. * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment.
  133. * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter.
  134. * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter.
  135. * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone).
  136. * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment.
  137. * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade.
  138. * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade.
  139. * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone).
  140. * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment.
  141. * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century.
  142. * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century.
  143. * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone).
  144. * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment.
  145. * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium.
  146. * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium.
  147. * @method CarbonImmutable years(int $value) Set current instance year to the given value.
  148. * @method CarbonImmutable year(int $value) Set current instance year to the given value.
  149. * @method CarbonImmutable setYears(int $value) Set current instance year to the given value.
  150. * @method CarbonImmutable setYear(int $value) Set current instance year to the given value.
  151. * @method CarbonImmutable months(int $value) Set current instance month to the given value.
  152. * @method CarbonImmutable month(int $value) Set current instance month to the given value.
  153. * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value.
  154. * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value.
  155. * @method CarbonImmutable days(int $value) Set current instance day to the given value.
  156. * @method CarbonImmutable day(int $value) Set current instance day to the given value.
  157. * @method CarbonImmutable setDays(int $value) Set current instance day to the given value.
  158. * @method CarbonImmutable setDay(int $value) Set current instance day to the given value.
  159. * @method CarbonImmutable hours(int $value) Set current instance hour to the given value.
  160. * @method CarbonImmutable hour(int $value) Set current instance hour to the given value.
  161. * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value.
  162. * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value.
  163. * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value.
  164. * @method CarbonImmutable minute(int $value) Set current instance minute to the given value.
  165. * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value.
  166. * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value.
  167. * @method CarbonImmutable seconds(int $value) Set current instance second to the given value.
  168. * @method CarbonImmutable second(int $value) Set current instance second to the given value.
  169. * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value.
  170. * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value.
  171. * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value.
  172. * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value.
  173. * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value.
  174. * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value.
  175. * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value.
  176. * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value.
  177. * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value.
  178. * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value.
  179. * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value.
  180. * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value.
  181. * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value.
  182. * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value.
  183. * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value.
  184. * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value.
  185. * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value.
  186. * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value.
  187. * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval).
  188. * @method CarbonImmutable addYear() Add one year to the instance (using date interval).
  189. * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
  190. * @method CarbonImmutable subYear() Sub one year to the instance (using date interval).
  191. * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  192. * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed.
  193. * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  194. * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed.
  195. * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  196. * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
  197. * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  198. * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
  199. * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  200. * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
  201. * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  202. * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
  203. * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  204. * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden.
  205. * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  206. * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden.
  207. * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval).
  208. * @method CarbonImmutable addMonth() Add one month to the instance (using date interval).
  209. * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval).
  210. * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval).
  211. * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  212. * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed.
  213. * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  214. * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed.
  215. * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  216. * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
  217. * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  218. * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
  219. * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  220. * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
  221. * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  222. * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
  223. * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  224. * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden.
  225. * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  226. * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden.
  227. * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval).
  228. * @method CarbonImmutable addDay() Add one day to the instance (using date interval).
  229. * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval).
  230. * @method CarbonImmutable subDay() Sub one day to the instance (using date interval).
  231. * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval).
  232. * @method CarbonImmutable addHour() Add one hour to the instance (using date interval).
  233. * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval).
  234. * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval).
  235. * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval).
  236. * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval).
  237. * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval).
  238. * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval).
  239. * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval).
  240. * @method CarbonImmutable addSecond() Add one second to the instance (using date interval).
  241. * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval).
  242. * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval).
  243. * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval).
  244. * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval).
  245. * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval).
  246. * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval).
  247. * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval).
  248. * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval).
  249. * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval).
  250. * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval).
  251. * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval).
  252. * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval).
  253. * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval).
  254. * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval).
  255. * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval).
  256. * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval).
  257. * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval).
  258. * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval).
  259. * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval).
  260. * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval).
  261. * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval).
  262. * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval).
  263. * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  264. * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed.
  265. * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  266. * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed.
  267. * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  268. * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
  269. * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  270. * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
  271. * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  272. * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
  273. * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  274. * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
  275. * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  276. * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
  277. * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  278. * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
  279. * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval).
  280. * @method CarbonImmutable addCentury() Add one century to the instance (using date interval).
  281. * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval).
  282. * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval).
  283. * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  284. * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed.
  285. * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  286. * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed.
  287. * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  288. * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
  289. * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  290. * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
  291. * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  292. * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
  293. * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  294. * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
  295. * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  296. * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden.
  297. * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  298. * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden.
  299. * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval).
  300. * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval).
  301. * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval).
  302. * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval).
  303. * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  304. * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed.
  305. * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  306. * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed.
  307. * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  308. * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
  309. * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  310. * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
  311. * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  312. * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
  313. * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  314. * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
  315. * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  316. * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden.
  317. * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  318. * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
  319. * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval).
  320. * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval).
  321. * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval).
  322. * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval).
  323. * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  324. * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed.
  325. * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
  326. * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed.
  327. * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  328. * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
  329. * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  330. * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
  331. * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  332. * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
  333. * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  334. * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
  335. * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  336. * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
  337. * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
  338. * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
  339. * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval).
  340. * @method CarbonImmutable addWeek() Add one week to the instance (using date interval).
  341. * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval).
  342. * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval).
  343. * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval).
  344. * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval).
  345. * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval).
  346. * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval).
  347. * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp).
  348. * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp).
  349. * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp).
  350. * @method CarbonImmutable subRealMicro() Sub one microsecond to the instance (using timestamp).
  351. * @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.
  352. * @method CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp).
  353. * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp).
  354. * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp).
  355. * @method CarbonImmutable subRealMicrosecond() Sub one microsecond to the instance (using timestamp).
  356. * @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.
  357. * @method CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp).
  358. * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp).
  359. * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp).
  360. * @method CarbonImmutable subRealMilli() Sub one millisecond to the instance (using timestamp).
  361. * @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.
  362. * @method CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp).
  363. * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp).
  364. * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp).
  365. * @method CarbonImmutable subRealMillisecond() Sub one millisecond to the instance (using timestamp).
  366. * @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.
  367. * @method CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp).
  368. * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp).
  369. * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp).
  370. * @method CarbonImmutable subRealSecond() Sub one second to the instance (using timestamp).
  371. * @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.
  372. * @method CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp).
  373. * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp).
  374. * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp).
  375. * @method CarbonImmutable subRealMinute() Sub one minute to the instance (using timestamp).
  376. * @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.
  377. * @method CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp).
  378. * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp).
  379. * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp).
  380. * @method CarbonImmutable subRealHour() Sub one hour to the instance (using timestamp).
  381. * @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.
  382. * @method CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp).
  383. * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp).
  384. * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp).
  385. * @method CarbonImmutable subRealDay() Sub one day to the instance (using timestamp).
  386. * @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.
  387. * @method CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp).
  388. * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp).
  389. * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp).
  390. * @method CarbonImmutable subRealWeek() Sub one week to the instance (using timestamp).
  391. * @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.
  392. * @method CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp).
  393. * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp).
  394. * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp).
  395. * @method CarbonImmutable subRealMonth() Sub one month to the instance (using timestamp).
  396. * @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.
  397. * @method CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp).
  398. * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp).
  399. * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp).
  400. * @method CarbonImmutable subRealQuarter() Sub one quarter to the instance (using timestamp).
  401. * @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.
  402. * @method CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp).
  403. * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp).
  404. * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp).
  405. * @method CarbonImmutable subRealYear() Sub one year to the instance (using timestamp).
  406. * @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.
  407. * @method CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp).
  408. * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp).
  409. * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp).
  410. * @method CarbonImmutable subRealDecade() Sub one decade to the instance (using timestamp).
  411. * @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.
  412. * @method CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp).
  413. * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp).
  414. * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp).
  415. * @method CarbonImmutable subRealCentury() Sub one century to the instance (using timestamp).
  416. * @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.
  417. * @method CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp).
  418. * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp).
  419. * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp).
  420. * @method CarbonImmutable subRealMillennium() Sub one millennium to the instance (using timestamp).
  421. * @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.
  422. * @method CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function.
  423. * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function.
  424. * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision.
  425. * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision.
  426. * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision.
  427. * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision.
  428. * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function.
  429. * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function.
  430. * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision.
  431. * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision.
  432. * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision.
  433. * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision.
  434. * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function.
  435. * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function.
  436. * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision.
  437. * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision.
  438. * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision.
  439. * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision.
  440. * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function.
  441. * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function.
  442. * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision.
  443. * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision.
  444. * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision.
  445. * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision.
  446. * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function.
  447. * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function.
  448. * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision.
  449. * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision.
  450. * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision.
  451. * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision.
  452. * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function.
  453. * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function.
  454. * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision.
  455. * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision.
  456. * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision.
  457. * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision.
  458. * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function.
  459. * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function.
  460. * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision.
  461. * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision.
  462. * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision.
  463. * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision.
  464. * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function.
  465. * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function.
  466. * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision.
  467. * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision.
  468. * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision.
  469. * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision.
  470. * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function.
  471. * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function.
  472. * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision.
  473. * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision.
  474. * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision.
  475. * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision.
  476. * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function.
  477. * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function.
  478. * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision.
  479. * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision.
  480. * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision.
  481. * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision.
  482. * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function.
  483. * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function.
  484. * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision.
  485. * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision.
  486. * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision.
  487. * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision.
  488. * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function.
  489. * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function.
  490. * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision.
  491. * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision.
  492. * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision.
  493. * @method CarbonImmutable ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision.
  494. * @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.)
  495. * @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.)
  496. * @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.)
  497. * @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.)
  498. * @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.)
  499. * @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.)
  500. * @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.)
  501. * @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.)
  502. * @method static CarbonImmutable|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format.
  503. * @method static CarbonImmutable __set_state(array $array) https://php.net/manual/en/datetime.set-state.php
  504. *
  505. * </autodoc>
  506. */
  507. class CarbonImmutable extends DateTimeImmutable implements CarbonInterface
  508. {
  509. use Date {
  510. __clone as dateTraitClone;
  511. }
  512. public function __clone()
  513. {
  514. $this->dateTraitClone();
  515. $this->endOfTime = false;
  516. $this->startOfTime = false;
  517. }
  518. /**
  519. * Create a very old date representing start of time.
  520. *
  521. * @return static
  522. */
  523. public static function startOfTime(): self
  524. {
  525. $date = static::parse('0001-01-01')->years(self::getStartOfTimeYear());
  526. $date->startOfTime = true;
  527. return $date;
  528. }
  529. /**
  530. * Create a very far date representing end of time.
  531. *
  532. * @return static
  533. */
  534. public static function endOfTime(): self
  535. {
  536. $date = static::parse('9999-12-31 23:59:59.999999')->years(self::getEndOfTimeYear());
  537. $date->endOfTime = true;
  538. return $date;
  539. }
  540. /**
  541. * @codeCoverageIgnore
  542. */
  543. private static function getEndOfTimeYear(): int
  544. {
  545. if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
  546. return 145261681241552;
  547. }
  548. // Remove if https://bugs.php.net/bug.php?id=81107 is fixed
  549. if (version_compare(PHP_VERSION, '8.1.0-dev', '>=')) {
  550. return 1118290769066902787;
  551. }
  552. return PHP_INT_MAX;
  553. }
  554. /**
  555. * @codeCoverageIgnore
  556. */
  557. private static function getStartOfTimeYear(): int
  558. {
  559. if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
  560. return -135908816449551;
  561. }
  562. // Remove if https://bugs.php.net/bug.php?id=81107 is fixed
  563. if (version_compare(PHP_VERSION, '8.1.0-dev', '>=')) {
  564. return -1118290769066898816;
  565. }
  566. return max(PHP_INT_MIN, -9223372036854773760);
  567. }
  568. }