FileAccess Orion

CarbonImmutable extends DateTimeImmutable
in package
implements CarbonInterface Uses Date

A simple API extension for DateTimeImmutable.

<autodoc generated by composer phpdoc>

Interfaces, Classes, Traits and Enums

CarbonInterface
Common interface for Carbon and CarbonImmutable.

Table of Contents

$age  : int
$century  : int
$day  : int
$dayName  : string
$dayOfWeek  : int
$dayOfWeekIso  : int
$dayOfYear  : int
$daysInMonth  : int
$daysInYear  : int
$decade  : int
$dst  : bool
$englishDayOfWeek  : string
$englishMonth  : string
$firstWeekDay  : int
$hour  : int
$isoWeek  : int
$isoWeeksInYear  : int
$isoWeekYear  : int
$lastWeekDay  : int
$latinMeridiem  : string
$latinUpperMeridiem  : string
$local  : bool
$locale  : string
$localeDayOfWeek  : string
$localeMonth  : string
$meridiem  : string
$micro  : int
$microsecond  : int
$millennium  : int
$milli  : int
$millisecond  : int
$milliseconds  : int
$minDayName  : string
$minute  : int
$month  : int
$monthName  : string
$noZeroHour  : int
$offset  : int
$offsetHours  : int
$offsetMinutes  : int
$quarter  : int
$second  : int
$shortDayName  : string
$shortEnglishDayOfWeek  : string
$shortEnglishMonth  : string
$shortLocaleDayOfWeek  : string
$shortLocaleMonth  : string
$shortMonthName  : string
$timestamp  : int
$timezone  : CarbonTimeZone
$timezoneAbbreviatedName  : string
$timezoneName  : string
$tz  : CarbonTimeZone
$tzAbbrName  : string
$tzName  : string
$upperMeridiem  : string
$utc  : bool
$week  : int
$weekNumberInMonth  : int
$weekOfMonth  : int
$weekOfYear  : int
$weeksInYear  : int
$weekYear  : int
$year  : int
$yearIso  : int
$days  : array<string|int, mixed>
Names of days of the week.
$units  : array<string|int, mixed>
List of unit and magic methods associated as doc-comments.
$utf8  : bool
Will UTF8 encoding be used to print localized date/time ?
__call()  : mixed
Dynamically handle calls to the class.
__callStatic()  : mixed
Dynamically handle calls to the class.
__get()  : string|int|bool|DateTimeZone|null
Get a part of the Carbon object
__isset()  : bool
Check if an attribute exists on the object
__set()  : void
Set a part of the Carbon object
__set_state()  : static
The __set_state handler.
addCenturies()  : CarbonImmutable
addCenturiesNoOverflow()  : CarbonImmutable
addCenturiesWithNoOverflow()  : CarbonImmutable
addCenturiesWithoutOverflow()  : CarbonImmutable
addCenturiesWithOverflow()  : CarbonImmutable
addCentury()  : CarbonImmutable
addCenturyNoOverflow()  : CarbonImmutable
addCenturyWithNoOverflow()  : CarbonImmutable
addCenturyWithoutOverflow()  : CarbonImmutable
addCenturyWithOverflow()  : CarbonImmutable
addDay()  : CarbonImmutable
addDays()  : CarbonImmutable
addDecade()  : CarbonImmutable
addDecadeNoOverflow()  : CarbonImmutable
addDecades()  : CarbonImmutable
addDecadesNoOverflow()  : CarbonImmutable
addDecadesWithNoOverflow()  : CarbonImmutable
addDecadesWithoutOverflow()  : CarbonImmutable
addDecadesWithOverflow()  : CarbonImmutable
addDecadeWithNoOverflow()  : CarbonImmutable
addDecadeWithoutOverflow()  : CarbonImmutable
addDecadeWithOverflow()  : CarbonImmutable
addHour()  : CarbonImmutable
addHours()  : CarbonImmutable
addMicro()  : CarbonImmutable
addMicros()  : CarbonImmutable
addMicrosecond()  : CarbonImmutable
addMicroseconds()  : CarbonImmutable
addMillennia()  : CarbonImmutable
addMillenniaNoOverflow()  : CarbonImmutable
addMillenniaWithNoOverflow()  : CarbonImmutable
addMillenniaWithoutOverflow()  : CarbonImmutable
addMillenniaWithOverflow()  : CarbonImmutable
addMillennium()  : CarbonImmutable
addMillenniumNoOverflow()  : CarbonImmutable
addMillenniumWithNoOverflow()  : CarbonImmutable
addMillenniumWithoutOverflow()  : CarbonImmutable
addMillenniumWithOverflow()  : CarbonImmutable
addMilli()  : CarbonImmutable
addMillis()  : CarbonImmutable
addMillisecond()  : CarbonImmutable
addMilliseconds()  : CarbonImmutable
addMinute()  : CarbonImmutable
addMinutes()  : CarbonImmutable
addMonth()  : CarbonImmutable
addMonthNoOverflow()  : CarbonImmutable
addMonths()  : CarbonImmutable
addMonthsNoOverflow()  : CarbonImmutable
addMonthsWithNoOverflow()  : CarbonImmutable
addMonthsWithoutOverflow()  : CarbonImmutable
addMonthsWithOverflow()  : CarbonImmutable
addMonthWithNoOverflow()  : CarbonImmutable
addMonthWithoutOverflow()  : CarbonImmutable
addMonthWithOverflow()  : CarbonImmutable
addQuarter()  : CarbonImmutable
addQuarterNoOverflow()  : CarbonImmutable
addQuarters()  : CarbonImmutable
addQuartersNoOverflow()  : CarbonImmutable
addQuartersWithNoOverflow()  : CarbonImmutable
addQuartersWithoutOverflow()  : CarbonImmutable
addQuartersWithOverflow()  : CarbonImmutable
addQuarterWithNoOverflow()  : CarbonImmutable
addQuarterWithoutOverflow()  : CarbonImmutable
addQuarterWithOverflow()  : CarbonImmutable
addRealCenturies()  : CarbonImmutable
addRealCentury()  : CarbonImmutable
addRealDay()  : CarbonImmutable
addRealDays()  : CarbonImmutable
addRealDecade()  : CarbonImmutable
addRealDecades()  : CarbonImmutable
addRealHour()  : CarbonImmutable
addRealHours()  : CarbonImmutable
addRealMicro()  : CarbonImmutable
addRealMicros()  : CarbonImmutable
addRealMicrosecond()  : CarbonImmutable
addRealMicroseconds()  : CarbonImmutable
addRealMillennia()  : CarbonImmutable
addRealMillennium()  : CarbonImmutable
addRealMilli()  : CarbonImmutable
addRealMillis()  : CarbonImmutable
addRealMillisecond()  : CarbonImmutable
addRealMilliseconds()  : CarbonImmutable
addRealMinute()  : CarbonImmutable
addRealMinutes()  : CarbonImmutable
addRealMonth()  : CarbonImmutable
addRealMonths()  : CarbonImmutable
addRealQuarter()  : CarbonImmutable
addRealQuarters()  : CarbonImmutable
addRealSecond()  : CarbonImmutable
addRealSeconds()  : CarbonImmutable
addRealWeek()  : CarbonImmutable
addRealWeeks()  : CarbonImmutable
addRealYear()  : CarbonImmutable
addRealYears()  : CarbonImmutable
addSecond()  : CarbonImmutable
addSeconds()  : CarbonImmutable
addUnitNoOverflow()  : static
Add any unit to a new value without overflowing current other unit given.
addWeek()  : CarbonImmutable
addWeekday()  : CarbonImmutable
addWeekdays()  : CarbonImmutable
addWeeks()  : CarbonImmutable
addYear()  : CarbonImmutable
addYearNoOverflow()  : CarbonImmutable
addYears()  : CarbonImmutable
addYearsNoOverflow()  : CarbonImmutable
addYearsWithNoOverflow()  : CarbonImmutable
addYearsWithoutOverflow()  : CarbonImmutable
addYearsWithOverflow()  : CarbonImmutable
addYearWithNoOverflow()  : CarbonImmutable
addYearWithoutOverflow()  : CarbonImmutable
addYearWithOverflow()  : CarbonImmutable
carbonize()  : static
Return the Carbon instance passed through, a now instance in the same timezone if null given or parse the input if string given.
ceilCenturies()  : CarbonImmutable
ceilCentury()  : CarbonImmutable
ceilDay()  : CarbonImmutable
ceilDays()  : CarbonImmutable
ceilDecade()  : CarbonImmutable
ceilDecades()  : CarbonImmutable
ceilHour()  : CarbonImmutable
ceilHours()  : CarbonImmutable
ceilMicrosecond()  : CarbonImmutable
ceilMicroseconds()  : CarbonImmutable
ceilMillennia()  : CarbonImmutable
ceilMillennium()  : CarbonImmutable
ceilMillisecond()  : CarbonImmutable
ceilMilliseconds()  : CarbonImmutable
ceilMinute()  : CarbonImmutable
ceilMinutes()  : CarbonImmutable
ceilMonth()  : CarbonImmutable
ceilMonths()  : CarbonImmutable
ceilQuarter()  : CarbonImmutable
ceilQuarters()  : CarbonImmutable
ceilSecond()  : CarbonImmutable
ceilSeconds()  : CarbonImmutable
ceilYear()  : CarbonImmutable
ceilYears()  : CarbonImmutable
centuriesUntil()  : CarbonPeriod
clone()  : static
copy()  : static
Get a copy of the instance.
createFromFormat()  : static|false
Create a Carbon instance from a specific format.
createFromMutable()  : CarbonImmutable
day()  : CarbonImmutable
dayOfYear()  : static|int
Get/set the day of year.
days()  : CarbonImmutable
daysUntil()  : CarbonPeriod
decadesUntil()  : CarbonPeriod
floorCenturies()  : CarbonImmutable
floorCentury()  : CarbonImmutable
floorDay()  : CarbonImmutable
floorDays()  : CarbonImmutable
floorDecade()  : CarbonImmutable
floorDecades()  : CarbonImmutable
floorHour()  : CarbonImmutable
floorHours()  : CarbonImmutable
floorMicrosecond()  : CarbonImmutable
floorMicroseconds()  : CarbonImmutable
floorMillennia()  : CarbonImmutable
floorMillennium()  : CarbonImmutable
floorMillisecond()  : CarbonImmutable
floorMilliseconds()  : CarbonImmutable
floorMinute()  : CarbonImmutable
floorMinutes()  : CarbonImmutable
floorMonth()  : CarbonImmutable
floorMonths()  : CarbonImmutable
floorQuarter()  : CarbonImmutable
floorQuarters()  : CarbonImmutable
floorSecond()  : CarbonImmutable
floorSeconds()  : CarbonImmutable
floorYear()  : CarbonImmutable
floorYears()  : CarbonImmutable
formatLocalized()  : string
Format the instance with the current locale. You can set the current locale using setlocale() http://php.net/setlocale.
get()  : string|int|bool|DateTimeZone|null
Get a part of the Carbon object
getAltNumber()  : string
Returns the alternative number for a given date property if available in the current locale.
getCalendarFormats()  : array<string|int, mixed>
Returns list of calendar formats for ISO formatting.
getDays()  : array<string|int, mixed>
Get the days of the week
getFormatsToIsoReplacements()  : array<string|int, mixed>
List of replacements from date() format to isoFormat().
getIsoFormats()  : array<string|int, mixed>
Returns list of locale formats for ISO formatting.
getIsoUnits()  : array<string|int, mixed>
Returns list of locale units for ISO formatting.
getOffsetString()  : string
Returns the offset hour and minute formatted with +/- and a given separator (":" by default).
getPaddedUnit()  : string
Returns a unit of the instance padded with 0 by default or any other string if specified.
getTimezone()  : CarbonTimeZone
Get the TimeZone associated with the Carbon instance (as CarbonTimeZone).
getTranslatedDayName()  : string
Get the translation of the current week day name (with context for languages with multiple forms).
getTranslatedMinDayName()  : string
Get the translation of the current abbreviated week day name (with context for languages with multiple forms).
getTranslatedMonthName()  : string
Get the translation of the current month day name (with context for languages with multiple forms).
getTranslatedShortDayName()  : string
Get the translation of the current short week day name (with context for languages with multiple forms).
getTranslatedShortMonthName()  : string
Get the translation of the current short month day name (with context for languages with multiple forms).
getWeekendDays()  : array<string|int, mixed>
Get weekend days
getWeekEndsAt()  : int
Get the last day of week
getWeekStartsAt()  : int
Get the first day of week
hasRelativeKeywords()  : bool
Determine if a time string will produce a relative date.
hour()  : CarbonImmutable
hours()  : CarbonImmutable
hoursUntil()  : CarbonPeriod
isCurrentCentury()  : bool
isCurrentDay()  : bool
isCurrentDecade()  : bool
isCurrentHour()  : bool
isCurrentMicro()  : bool
isCurrentMicrosecond()  : bool
isCurrentMillennium()  : bool
isCurrentMinute()  : bool
isCurrentMonth()  : bool
isCurrentQuarter()  : bool
isCurrentSecond()  : bool
isCurrentWeek()  : bool
isCurrentYear()  : bool
isDST()  : bool
isFriday()  : bool
isLastCentury()  : bool
isLastDay()  : bool
isLastDecade()  : bool
isLastHour()  : bool
isLastMicro()  : bool
isLastMicrosecond()  : bool
isLastMillennium()  : bool
isLastMinute()  : bool
isLastMonth()  : bool
isLastQuarter()  : bool
isLastSecond()  : bool
isLastWeek()  : bool
isLastYear()  : bool
isLocal()  : bool
isMonday()  : bool
isNextCentury()  : bool
isNextDay()  : bool
isNextDecade()  : bool
isNextHour()  : bool
isNextMicro()  : bool
isNextMicrosecond()  : bool
isNextMillennium()  : bool
isNextMinute()  : bool
isNextMonth()  : bool
isNextQuarter()  : bool
isNextSecond()  : bool
isNextWeek()  : bool
isNextYear()  : bool
isoFormat()  : string
Format in the current language using ISO replacement patterns.
isoWeekday()  : static|int
Get/set the ISO weekday from 1 (Monday) to 7 (Sunday).
isSameCentury()  : bool
isSameDay()  : bool
isSameDecade()  : bool
isSameHour()  : bool
isSameMicro()  : bool
isSameMicrosecond()  : bool
isSameMillennium()  : bool
isSameMinute()  : bool
isSameSecond()  : bool
isSameWeek()  : bool
isSameYear()  : bool
isSaturday()  : bool
isSunday()  : bool
isThursday()  : bool
isTuesday()  : bool
isUtc()  : bool
isValid()  : bool
isWednesday()  : bool
longAbsoluteDiffForHumans()  : string
longRelativeDiffForHumans()  : string
longRelativeToNowDiffForHumans()  : string
longRelativeToOtherDiffForHumans()  : string
meridiem()  : string
Return the meridiem of the current time in the current locale.
micro()  : CarbonImmutable
micros()  : CarbonImmutable
microsecond()  : CarbonImmutable
microseconds()  : CarbonImmutable
microsecondsUntil()  : CarbonPeriod
microsUntil()  : CarbonPeriod
millenniaUntil()  : CarbonPeriod
milli()  : CarbonImmutable
millis()  : CarbonImmutable
millisecond()  : CarbonImmutable
milliseconds()  : CarbonImmutable
millisecondsUntil()  : CarbonPeriod
millisUntil()  : CarbonPeriod
minute()  : CarbonImmutable
minutes()  : CarbonImmutable
minutesUntil()  : CarbonPeriod
month()  : CarbonImmutable
months()  : CarbonImmutable
monthsUntil()  : CarbonPeriod
nowWithSameTz()  : static
Returns a present instance in the same timezone.
ordinal()  : string
Return a property with its ordinal.
pluralUnit()  : string
Returns standardized plural of a given singular/plural unit name (in English).
quartersUntil()  : CarbonPeriod
roundCenturies()  : CarbonImmutable
roundCentury()  : CarbonImmutable
roundDay()  : CarbonImmutable
roundDays()  : CarbonImmutable
roundDecade()  : CarbonImmutable
roundDecades()  : CarbonImmutable
roundHour()  : CarbonImmutable
roundHours()  : CarbonImmutable
roundMicrosecond()  : CarbonImmutable
roundMicroseconds()  : CarbonImmutable
roundMillennia()  : CarbonImmutable
roundMillennium()  : CarbonImmutable
roundMillisecond()  : CarbonImmutable
roundMilliseconds()  : CarbonImmutable
roundMinute()  : CarbonImmutable
roundMinutes()  : CarbonImmutable
roundMonth()  : CarbonImmutable
roundMonths()  : CarbonImmutable
roundQuarter()  : CarbonImmutable
roundQuarters()  : CarbonImmutable
roundSecond()  : CarbonImmutable
roundSeconds()  : CarbonImmutable
roundYear()  : CarbonImmutable
roundYears()  : CarbonImmutable
second()  : CarbonImmutable
seconds()  : CarbonImmutable
secondsUntil()  : CarbonPeriod
set()  : $this
Set a part of the Carbon object
setDate()  : static
Set the date with gregorian year, month and day numbers.
setDateFrom()  : static
Set the year, month, and date for this instance to that of the passed instance.
setDateTime()  : static
Set the date and time all together.
setDateTimeFrom()  : static
Set the date and time for this instance to that of the passed instance.
setDay()  : CarbonImmutable
setDays()  : CarbonImmutable
setHour()  : CarbonImmutable
setHours()  : CarbonImmutable
setISODate()  : static
Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
setMicro()  : CarbonImmutable
setMicros()  : CarbonImmutable
setMicrosecond()  : CarbonImmutable
setMicroseconds()  : CarbonImmutable
setMilli()  : CarbonImmutable
setMillis()  : CarbonImmutable
setMillisecond()  : CarbonImmutable
setMilliseconds()  : CarbonImmutable
setMinute()  : CarbonImmutable
setMinutes()  : CarbonImmutable
setMonth()  : CarbonImmutable
setMonths()  : CarbonImmutable
setSecond()  : CarbonImmutable
setSeconds()  : CarbonImmutable
setTime()  : static
Resets the current time of the DateTime object to a different time.
setTimeFrom()  : static
Set the hour, minute, second and microseconds for this instance to that of the passed instance.
setTimeFromTimeString()  : static
Set the time by time string.
setTimestamp()  : static
Sets the date and time based on an Unix timestamp.
setTimezone()  : static
Set the instance's timezone from a string or object.
setUnit()  : static
Set specified unit to new given value.
setUnitNoOverflow()  : static
Set any unit to a new value without overflowing current other unit given.
setUtf8()  : mixed
setWeekendDays()  : void
setWeekEndsAt()  : void
setWeekStartsAt()  : void
setYear()  : CarbonImmutable
setYears()  : CarbonImmutable
shiftTimezone()  : static
Set the instance's timezone from a string or object and add/subtract the offset difference.
shortAbsoluteDiffForHumans()  : string
shortRelativeDiffForHumans()  : string
shortRelativeToNowDiffForHumans()  : string
shortRelativeToOtherDiffForHumans()  : string
singularUnit()  : string
Returns standardized singular of a given singular/plural unit name (in English).
subCenturies()  : CarbonImmutable
subCenturiesNoOverflow()  : CarbonImmutable
subCenturiesWithNoOverflow()  : CarbonImmutable
subCenturiesWithoutOverflow()  : CarbonImmutable
subCenturiesWithOverflow()  : CarbonImmutable
subCentury()  : CarbonImmutable
subCenturyNoOverflow()  : CarbonImmutable
subCenturyWithNoOverflow()  : CarbonImmutable
subCenturyWithoutOverflow()  : CarbonImmutable
subCenturyWithOverflow()  : CarbonImmutable
subDay()  : CarbonImmutable
subDays()  : CarbonImmutable
subDecade()  : CarbonImmutable
subDecadeNoOverflow()  : CarbonImmutable
subDecades()  : CarbonImmutable
subDecadesNoOverflow()  : CarbonImmutable
subDecadesWithNoOverflow()  : CarbonImmutable
subDecadesWithoutOverflow()  : CarbonImmutable
subDecadesWithOverflow()  : CarbonImmutable
subDecadeWithNoOverflow()  : CarbonImmutable
subDecadeWithoutOverflow()  : CarbonImmutable
subDecadeWithOverflow()  : CarbonImmutable
subHour()  : CarbonImmutable
subHours()  : CarbonImmutable
subMicro()  : CarbonImmutable
subMicros()  : CarbonImmutable
subMicrosecond()  : CarbonImmutable
subMicroseconds()  : CarbonImmutable
subMillennia()  : CarbonImmutable
subMillenniaNoOverflow()  : CarbonImmutable
subMillenniaWithNoOverflow()  : CarbonImmutable
subMillenniaWithoutOverflow()  : CarbonImmutable
subMillenniaWithOverflow()  : CarbonImmutable
subMillennium()  : CarbonImmutable
subMillenniumNoOverflow()  : CarbonImmutable
subMillenniumWithNoOverflow()  : CarbonImmutable
subMillenniumWithoutOverflow()  : CarbonImmutable
subMillenniumWithOverflow()  : CarbonImmutable
subMilli()  : CarbonImmutable
subMillis()  : CarbonImmutable
subMillisecond()  : CarbonImmutable
subMilliseconds()  : CarbonImmutable
subMinute()  : CarbonImmutable
subMinutes()  : CarbonImmutable
subMonth()  : CarbonImmutable
subMonthNoOverflow()  : CarbonImmutable
subMonths()  : CarbonImmutable
subMonthsNoOverflow()  : CarbonImmutable
subMonthsWithNoOverflow()  : CarbonImmutable
subMonthsWithoutOverflow()  : CarbonImmutable
subMonthsWithOverflow()  : CarbonImmutable
subMonthWithNoOverflow()  : CarbonImmutable
subMonthWithoutOverflow()  : CarbonImmutable
subMonthWithOverflow()  : CarbonImmutable
subQuarter()  : CarbonImmutable
subQuarterNoOverflow()  : CarbonImmutable
subQuarters()  : CarbonImmutable
subQuartersNoOverflow()  : CarbonImmutable
subQuartersWithNoOverflow()  : CarbonImmutable
subQuartersWithoutOverflow()  : CarbonImmutable
subQuartersWithOverflow()  : CarbonImmutable
subQuarterWithNoOverflow()  : CarbonImmutable
subQuarterWithoutOverflow()  : CarbonImmutable
subQuarterWithOverflow()  : CarbonImmutable
subRealCenturies()  : CarbonImmutable
subRealCentury()  : CarbonImmutable
subRealDay()  : CarbonImmutable
subRealDays()  : CarbonImmutable
subRealDecade()  : CarbonImmutable
subRealDecades()  : CarbonImmutable
subRealHour()  : CarbonImmutable
subRealHours()  : CarbonImmutable
subRealMicro()  : CarbonImmutable
subRealMicros()  : CarbonImmutable
subRealMicrosecond()  : CarbonImmutable
subRealMicroseconds()  : CarbonImmutable
subRealMillennia()  : CarbonImmutable
subRealMillennium()  : CarbonImmutable
subRealMilli()  : CarbonImmutable
subRealMillis()  : CarbonImmutable
subRealMillisecond()  : CarbonImmutable
subRealMilliseconds()  : CarbonImmutable
subRealMinute()  : CarbonImmutable
subRealMinutes()  : CarbonImmutable
subRealMonth()  : CarbonImmutable
subRealMonths()  : CarbonImmutable
subRealQuarter()  : CarbonImmutable
subRealQuarters()  : CarbonImmutable
subRealSecond()  : CarbonImmutable
subRealSeconds()  : CarbonImmutable
subRealWeek()  : CarbonImmutable
subRealWeeks()  : CarbonImmutable
subRealYear()  : CarbonImmutable
subRealYears()  : CarbonImmutable
subSecond()  : CarbonImmutable
subSeconds()  : CarbonImmutable
subUnitNoOverflow()  : static
Subtract any unit to a new value without overflowing current other unit given.
subWeek()  : CarbonImmutable
subWeekday()  : CarbonImmutable
subWeekdays()  : CarbonImmutable
subWeeks()  : CarbonImmutable
subYear()  : CarbonImmutable
subYearNoOverflow()  : CarbonImmutable
subYears()  : CarbonImmutable
subYearsNoOverflow()  : CarbonImmutable
subYearsWithNoOverflow()  : CarbonImmutable
subYearsWithoutOverflow()  : CarbonImmutable
subYearsWithOverflow()  : CarbonImmutable
subYearWithNoOverflow()  : CarbonImmutable
subYearWithoutOverflow()  : CarbonImmutable
subYearWithOverflow()  : CarbonImmutable
timezone()  : static
translatedFormat()  : string
Format as ->format() do (using date replacements patterns from http://php.net/manual/fr/function.date.php) but translate words whenever possible (months, day names, etc.) using the current locale.
tz()  : static|string
Set the timezone or returns the timezone name if no arguments passed.
utc()  : static
Set the instance's timezone to UTC.
utcOffset()  : int|static
Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.
weekday()  : static|int
Get/set the weekday from 0 (Sunday) to 6 (Saturday).
weeksUntil()  : CarbonPeriod
year()  : CarbonImmutable
years()  : CarbonImmutable
yearsUntil()  : CarbonPeriod
executeCallable()  : mixed
executeCallableWithContext()  : mixed
executeStaticCallable()  : mixed
expectDateTime()  : mixed
Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface.
getGenericMacros()  : mixed
getRangesByUnit()  : array<string|int, mixed>
List of minimum and maximums for each unit.
getTranslatedFormByRegExp()  : mixed
resolveCarbon()  : static
Return the Carbon instance passed through, a now instance in the same timezone if null given or parse the input if string given.
safeCreateDateTimeZone()  : CarbonTimeZone|false
Creates a DateTimeZone from a string, DateTimeZone or integer offset.

Properties

$dayName read-only

public string $dayName

long name of weekday translated according to Carbon locale, in english if no translation available for current language

$dayOfWeek read-only

public int $dayOfWeek

0 (for Sunday) through 6 (for Saturday)

$dayOfWeekIso read-only

public int $dayOfWeekIso

1 (for Monday) through 7 (for Sunday)

$daysInMonth read-only

public int $daysInMonth

number of days in the given month

$dst read-only

public bool $dst

daylight savings time indicator, true if DST, false otherwise

$englishDayOfWeek

public string $englishDayOfWeek

the day of week in English

$isoWeekYear

public int $isoWeekYear

year according to ISO week format

$latinMeridiem read-only

public string $latinMeridiem

"am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark)

$latinUpperMeridiem read-only

public string $latinUpperMeridiem

"AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark)

$local read-only

public bool $local

checks if the timezone is local, true if local, false otherwise

$locale read-only

public string $locale

locale of the current instance

$localeDayOfWeek

public string $localeDayOfWeek

the day of week in current locale LC_TIME

$localeMonth

public string $localeMonth

the month in current locale LC_TIME

$meridiem read-only

public string $meridiem

lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language

$millennium read-only

public int $millennium

the millennium of this instance

$minDayName read-only

public string $minDayName

very short name of weekday translated according to Carbon locale, in english if no translation available for current language

$monthName read-only

public string $monthName

long name of month translated according to Carbon locale, in english if no translation available for current language

$noZeroHour read-only

public int $noZeroHour

current hour from 1 to 24

$offsetHours

public int $offsetHours

the timezone offset in hours from UTC

$offsetMinutes

public int $offsetMinutes

the timezone offset in minutes from UTC

$quarter read-only

public int $quarter

the quarter of this instance, 1 - 4

$shortDayName read-only

public string $shortDayName

short name of weekday translated according to Carbon locale, in english if no translation available for current language

$shortEnglishDayOfWeek

public string $shortEnglishDayOfWeek

the abbreviated day of week in English

$shortEnglishMonth

public string $shortEnglishMonth

the abbreviated month in English

$shortLocaleDayOfWeek

public string $shortLocaleDayOfWeek

the abbreviated day of week in current locale LC_TIME

$shortLocaleMonth

public string $shortLocaleMonth

the abbreviated month in current locale LC_TIME

$shortMonthName read-only

public string $shortMonthName

short name of month translated according to Carbon locale, in english if no translation available for current language

$timezoneAbbreviatedName read-only

public string $timezoneAbbreviatedName

the current timezone abbreviated name

$timezoneName read-only

public string $timezoneName

the current timezone name

$tzAbbrName read-only

public string $tzAbbrName

alias of $timezoneAbbreviatedName

$upperMeridiem read-only

public string $upperMeridiem

uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language

$utc read-only

public bool $utc

checks if the timezone is UTC, true if UTC, false otherwise

$weekNumberInMonth read-only

public int $weekNumberInMonth

1 through 5

$weekOfYear read-only

public int $weekOfYear

ISO-8601 week number of year, weeks starting on Monday

$days

Names of days of the week.

protected static array<string|int, mixed> $days = [ // @call isDayOfWeek \Carbon\CarbonInterface::SUNDAY => 'Sunday', // @call isDayOfWeek \Carbon\CarbonInterface::MONDAY => 'Monday', // @call isDayOfWeek \Carbon\CarbonInterface::TUESDAY => 'Tuesday', // @call isDayOfWeek \Carbon\CarbonInterface::WEDNESDAY => 'Wednesday', // @call isDayOfWeek \Carbon\CarbonInterface::THURSDAY => 'Thursday', // @call isDayOfWeek \Carbon\CarbonInterface::FRIDAY => 'Friday', // @call isDayOfWeek \Carbon\CarbonInterface::SATURDAY => 'Saturday', ]

$units

List of unit and magic methods associated as doc-comments.

protected static array<string|int, mixed> $units = [ // @call setUnit // @call addUnit 'year', // @call setUnit // @call addUnit 'month', // @call setUnit // @call addUnit 'day', // @call setUnit // @call addUnit 'hour', // @call setUnit // @call addUnit 'minute', // @call setUnit // @call addUnit 'second', // @call setUnit // @call addUnit 'milli', // @call setUnit // @call addUnit 'millisecond', // @call setUnit // @call addUnit 'micro', // @call setUnit // @call addUnit 'microsecond', ]

$utf8

Will UTF8 encoding be used to print localized date/time ?

protected static bool $utf8 = false

Methods

__call()

Dynamically handle calls to the class.

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string

magic method name called

$parameters : array<string|int, mixed>

parameters list

Tags
throws
UnknownMethodException|BadMethodCallException|ReflectionException|Throwable
Return values
mixed —

__callStatic()

Dynamically handle calls to the class.

public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string

magic method name called

$parameters : array<string|int, mixed>

parameters list

Tags
throws
BadMethodCallException
Return values
mixed —

__get()

Get a part of the Carbon object

public __get(string $name) : string|int|bool|DateTimeZone|null
Parameters
$name : string
Tags
throws
UnknownGetterException
Return values
string|int|bool|DateTimeZone|null —

__isset()

Check if an attribute exists on the object

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool —

__set()

Set a part of the Carbon object

public __set(string $name, string|int|DateTimeZone $value) : void
Parameters
$name : string
$value : string|int|DateTimeZone
Tags
throws
UnknownSetterException|ReflectionException
Return values
void —

__set_state()

The __set_state handler.

public static __set_state(array<string|int, mixed> $array) : static

https://php.net/manual/en/datetime.set-state.php

Parameters
$array : array<string|int, mixed>
Return values
static —

addCenturiesNoOverflow()

public addCenturiesNoOverflow(int $value = 1) : CarbonImmutable

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addCenturiesWithNoOverflow()

public addCenturiesWithNoOverflow(int $value = 1) : CarbonImmutable

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addCenturiesWithoutOverflow()

public addCenturiesWithoutOverflow(int $value = 1) : CarbonImmutable

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addCenturiesWithOverflow()

public addCenturiesWithOverflow(int $value = 1) : CarbonImmutable

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addDecadesNoOverflow()

public addDecadesNoOverflow(int $value = 1) : CarbonImmutable

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addDecadesWithNoOverflow()

public addDecadesWithNoOverflow(int $value = 1) : CarbonImmutable

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addDecadesWithoutOverflow()

public addDecadesWithoutOverflow(int $value = 1) : CarbonImmutable

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addDecadesWithOverflow()

public addDecadesWithOverflow(int $value = 1) : CarbonImmutable

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMicroseconds()

public addMicroseconds(int $value = 1) : CarbonImmutable

Add microseconds (the $value count passed in) to the instance (using date interval).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMillenniaNoOverflow()

public addMillenniaNoOverflow(int $value = 1) : CarbonImmutable

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMillenniaWithNoOverflow()

public addMillenniaWithNoOverflow(int $value = 1) : CarbonImmutable

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMillenniaWithoutOverflow()

public addMillenniaWithoutOverflow(int $value = 1) : CarbonImmutable

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMillenniaWithOverflow()

public addMillenniaWithOverflow(int $value = 1) : CarbonImmutable

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMilliseconds()

public addMilliseconds(int $value = 1) : CarbonImmutable

Add milliseconds (the $value count passed in) to the instance (using date interval).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMonthsNoOverflow()

public addMonthsNoOverflow(int $value = 1) : CarbonImmutable

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMonthsWithNoOverflow()

public addMonthsWithNoOverflow(int $value = 1) : CarbonImmutable

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMonthsWithoutOverflow()

public addMonthsWithoutOverflow(int $value = 1) : CarbonImmutable

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addMonthsWithOverflow()

public addMonthsWithOverflow(int $value = 1) : CarbonImmutable

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addQuartersNoOverflow()

public addQuartersNoOverflow(int $value = 1) : CarbonImmutable

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addQuartersWithNoOverflow()

public addQuartersWithNoOverflow(int $value = 1) : CarbonImmutable

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addQuartersWithoutOverflow()

public addQuartersWithoutOverflow(int $value = 1) : CarbonImmutable

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addQuartersWithOverflow()

public addQuartersWithOverflow(int $value = 1) : CarbonImmutable

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addRealMicroseconds()

public addRealMicroseconds(int $value = 1) : CarbonImmutable

Add microseconds (the $value count passed in) to the instance (using timestamp).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addRealMilliseconds()

public addRealMilliseconds(int $value = 1) : CarbonImmutable

Add milliseconds (the $value count passed in) to the instance (using timestamp).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addUnitNoOverflow()

Add any unit to a new value without overflowing current other unit given.

public addUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit) : static
Parameters
$valueUnit : string

unit name to modify

$value : int

amount to add to the input unit

$overflowUnit : string

unit name to not overflow

Return values
static —

addYearsNoOverflow()

public addYearsNoOverflow(int $value = 1) : CarbonImmutable

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addYearsWithNoOverflow()

public addYearsWithNoOverflow(int $value = 1) : CarbonImmutable

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addYearsWithoutOverflow()

public addYearsWithoutOverflow(int $value = 1) : CarbonImmutable

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

addYearsWithOverflow()

public addYearsWithOverflow(int $value = 1) : CarbonImmutable

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

carbonize()

Return the Carbon instance passed through, a now instance in the same timezone if null given or parse the input if string given.

public carbonize([Carbon|CarbonPeriod|CarbonInterval|DateInterval|DatePeriod|DateTimeInterface|string|null $date = null ]) : static
Parameters
$date : Carbon|CarbonPeriod|CarbonInterval|DateInterval|DatePeriod|DateTimeInterface|string|null = null
Return values
static —

centuriesUntil()

public centuriesUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

clone()

public clone() : static
Tags
alias

copy

Get a copy of the instance.

Return values
static —

copy()

Get a copy of the instance.

public copy() : static
Return values
static —

createFromFormat()

Create a Carbon instance from a specific format.

public static createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) : static|false

Parse a string into a new CarbonImmutable object according to the specified format.

Parameters
$format : string

Datetime format

$time : string
$timezone = null : string|DateTimeZone
Return values
static|false —

dayOfYear()

Get/set the day of year.

public dayOfYear([int|null $value = null ]) : static|int
Parameters
$value : int|null = null

new value for day of year if using as setter.

Return values
static|int —

daysUntil()

public daysUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

decadesUntil()

public decadesUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

formatLocalized()

Format the instance with the current locale. You can set the current locale using setlocale() http://php.net/setlocale.

public formatLocalized(string $format) : string
Parameters
$format : string
Return values
string —

get()

Get a part of the Carbon object

public get(string $name) : string|int|bool|DateTimeZone|null
Parameters
$name : string
Tags
throws
UnknownGetterException
Return values
string|int|bool|DateTimeZone|null —

getAltNumber()

Returns the alternative number for a given date property if available in the current locale.

public getAltNumber(string $key) : string
Parameters
$key : string

date property

Return values
string —

getCalendarFormats()

Returns list of calendar formats for ISO formatting.

public getCalendarFormats([string|null $locale = null ]) : array<string|int, mixed>
Parameters
$locale : string|null = null

current locale used if null

Return values
array<string|int, mixed> —

getDays()

Get the days of the week

public static getDays() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getFormatsToIsoReplacements()

List of replacements from date() format to isoFormat().

public static getFormatsToIsoReplacements() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getIsoFormats()

Returns list of locale formats for ISO formatting.

public getIsoFormats([string|null $locale = null ]) : array<string|int, mixed>
Parameters
$locale : string|null = null

current locale used if null

Return values
array<string|int, mixed> —

getIsoUnits()

Returns list of locale units for ISO formatting.

public static getIsoUnits() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getOffsetString()

Returns the offset hour and minute formatted with +/- and a given separator (":" by default).

public getOffsetString([string $separator = ':' ]) : string

For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something like "-12:00".

Parameters
$separator : string = ':'

string to place between hours and minutes (":" by default)

Return values
string —

getPaddedUnit()

Returns a unit of the instance padded with 0 by default or any other string if specified.

public getPaddedUnit(string $unit[, int $length = 2 ][, string $padString = '0' ][, int $padType = STR_PAD_LEFT ]) : string
Parameters
$unit : string

Carbon unit name

$length : int = 2

Length of the output (2 by default)

$padString : string = '0'

String to use for padding ("0" by default)

$padType : int = STR_PAD_LEFT

Side(s) to pad (STR_PAD_LEFT by default)

Return values
string —

getTranslatedDayName()

Get the translation of the current week day name (with context for languages with multiple forms).

public getTranslatedDayName([string|null $context = null ][, string $keySuffix = '' ][, string|null $defaultValue = null ]) : string
Parameters
$context : string|null = null

whole format string

$keySuffix : string = ''

"", "_short" or "_min"

$defaultValue : string|null = null

default value if translation missing

Return values
string —

getTranslatedMinDayName()

Get the translation of the current abbreviated week day name (with context for languages with multiple forms).

public getTranslatedMinDayName([string|null $context = null ]) : string
Parameters
$context : string|null = null

whole format string

Return values
string —

getTranslatedMonthName()

Get the translation of the current month day name (with context for languages with multiple forms).

public getTranslatedMonthName([string|null $context = null ][, string $keySuffix = '' ][, string|null $defaultValue = null ]) : string
Parameters
$context : string|null = null

whole format string

$keySuffix : string = ''

"" or "_short"

$defaultValue : string|null = null

default value if translation missing

Return values
string —

getTranslatedShortDayName()

Get the translation of the current short week day name (with context for languages with multiple forms).

public getTranslatedShortDayName([string|null $context = null ]) : string
Parameters
$context : string|null = null

whole format string

Return values
string —

getTranslatedShortMonthName()

Get the translation of the current short month day name (with context for languages with multiple forms).

public getTranslatedShortMonthName([string|null $context = null ]) : string
Parameters
$context : string|null = null

whole format string

Return values
string —

getWeekendDays()

Get weekend days

public static getWeekendDays() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getWeekEndsAt()

Get the last day of week

public static getWeekEndsAt() : int
Return values
int —

getWeekStartsAt()

Get the first day of week

public static getWeekStartsAt() : int
Return values
int —

hasRelativeKeywords()

Determine if a time string will produce a relative date.

public static hasRelativeKeywords(string $time) : bool
Parameters
$time : string
Return values
bool —

true if time match a relative date, false if absolute or invalid time string

hoursUntil()

public hoursUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

isCurrentCentury()

public isCurrentCentury() : bool

Checks if the instance is in the same century as the current moment.

Return values
bool —

isCurrentDay()

public isCurrentDay() : bool

Checks if the instance is in the same day as the current moment.

Return values
bool —

isCurrentDecade()

public isCurrentDecade() : bool

Checks if the instance is in the same decade as the current moment.

Return values
bool —

isCurrentHour()

public isCurrentHour() : bool

Checks if the instance is in the same hour as the current moment.

Return values
bool —

isCurrentMicro()

public isCurrentMicro() : bool

Checks if the instance is in the same microsecond as the current moment.

Return values
bool —

isCurrentMicrosecond()

public isCurrentMicrosecond() : bool

Checks if the instance is in the same microsecond as the current moment.

Return values
bool —

isCurrentMillennium()

public isCurrentMillennium() : bool

Checks if the instance is in the same millennium as the current moment.

Return values
bool —

isCurrentMinute()

public isCurrentMinute() : bool

Checks if the instance is in the same minute as the current moment.

Return values
bool —

isCurrentMonth()

public isCurrentMonth() : bool

Checks if the instance is in the same month as the current moment.

Return values
bool —

isCurrentQuarter()

public isCurrentQuarter() : bool

Checks if the instance is in the same quarter as the current moment.

Return values
bool —

isCurrentSecond()

public isCurrentSecond() : bool

Checks if the instance is in the same second as the current moment.

Return values
bool —

isCurrentWeek()

public isCurrentWeek() : bool

Checks if the instance is in the same week as the current moment.

Return values
bool —

isCurrentYear()

public isCurrentYear() : bool

Checks if the instance is in the same year as the current moment.

Return values
bool —

isDST()

public isDST() : bool

Check if the current instance is in a daylight saving time.

Return values
bool —

isFriday()

public isFriday() : bool

Checks if the instance day is friday.

Return values
bool —

isLastCentury()

public isLastCentury() : bool

Checks if the instance is in the same century as the current moment last century.

Return values
bool —

isLastDay()

public isLastDay() : bool

Checks if the instance is in the same day as the current moment last day.

Return values
bool —

isLastDecade()

public isLastDecade() : bool

Checks if the instance is in the same decade as the current moment last decade.

Return values
bool —

isLastHour()

public isLastHour() : bool

Checks if the instance is in the same hour as the current moment last hour.

Return values
bool —

isLastMicro()

public isLastMicro() : bool

Checks if the instance is in the same microsecond as the current moment last microsecond.

Return values
bool —

isLastMicrosecond()

public isLastMicrosecond() : bool

Checks if the instance is in the same microsecond as the current moment last microsecond.

Return values
bool —

isLastMillennium()

public isLastMillennium() : bool

Checks if the instance is in the same millennium as the current moment last millennium.

Return values
bool —

isLastMinute()

public isLastMinute() : bool

Checks if the instance is in the same minute as the current moment last minute.

Return values
bool —

isLastMonth()

public isLastMonth() : bool

Checks if the instance is in the same month as the current moment last month.

Return values
bool —

isLastQuarter()

public isLastQuarter() : bool

Checks if the instance is in the same quarter as the current moment last quarter.

Return values
bool —

isLastSecond()

public isLastSecond() : bool

Checks if the instance is in the same second as the current moment last second.

Return values
bool —

isLastWeek()

public isLastWeek() : bool

Checks if the instance is in the same week as the current moment last week.

Return values
bool —

isLastYear()

public isLastYear() : bool

Checks if the instance is in the same year as the current moment last year.

Return values
bool —

isLocal()

public isLocal() : bool

Check if the current instance has non-UTC timezone.

Return values
bool —

isMonday()

public isMonday() : bool

Checks if the instance day is monday.

Return values
bool —

isNextCentury()

public isNextCentury() : bool

Checks if the instance is in the same century as the current moment next century.

Return values
bool —

isNextDay()

public isNextDay() : bool

Checks if the instance is in the same day as the current moment next day.

Return values
bool —

isNextDecade()

public isNextDecade() : bool

Checks if the instance is in the same decade as the current moment next decade.

Return values
bool —

isNextHour()

public isNextHour() : bool

Checks if the instance is in the same hour as the current moment next hour.

Return values
bool —

isNextMicro()

public isNextMicro() : bool

Checks if the instance is in the same microsecond as the current moment next microsecond.

Return values
bool —

isNextMicrosecond()

public isNextMicrosecond() : bool

Checks if the instance is in the same microsecond as the current moment next microsecond.

Return values
bool —

isNextMillennium()

public isNextMillennium() : bool

Checks if the instance is in the same millennium as the current moment next millennium.

Return values
bool —

isNextMinute()

public isNextMinute() : bool

Checks if the instance is in the same minute as the current moment next minute.

Return values
bool —

isNextMonth()

public isNextMonth() : bool

Checks if the instance is in the same month as the current moment next month.

Return values
bool —

isNextQuarter()

public isNextQuarter() : bool

Checks if the instance is in the same quarter as the current moment next quarter.

Return values
bool —

isNextSecond()

public isNextSecond() : bool

Checks if the instance is in the same second as the current moment next second.

Return values
bool —

isNextWeek()

public isNextWeek() : bool

Checks if the instance is in the same week as the current moment next week.

Return values
bool —

isNextYear()

public isNextYear() : bool

Checks if the instance is in the same year as the current moment next year.

Return values
bool —

isoFormat()

Format in the current language using ISO replacement patterns.

public isoFormat(string $format[, string|null $originalFormat = null ]) : string
Parameters
$format : string
$originalFormat : string|null = null

provide context if a chunk has been passed alone

Return values
string —

isoWeekday()

Get/set the ISO weekday from 1 (Monday) to 7 (Sunday).

public isoWeekday([int|null $value = null ]) : static|int
Parameters
$value : int|null = null

new value for weekday if using as setter.

Return values
static|int —

isSameCentury()

public isSameCentury(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameDay()

public isSameDay(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameDecade()

public isSameDecade(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameHour()

public isSameHour(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameMicro()

public isSameMicro(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameMicrosecond()

public isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameMillennium()

public isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameMinute()

public isSameMinute(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameSecond()

public isSameSecond(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameWeek()

public isSameWeek(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSameYear()

public isSameYear(Carbon|DateTimeInterface|string|null $date = null) : bool

Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null : Carbon|DateTimeInterface|string|null
Return values
bool —

isSaturday()

public isSaturday() : bool

Checks if the instance day is saturday.

Return values
bool —

isSunday()

public isSunday() : bool

Checks if the instance day is sunday.

Return values
bool —

isThursday()

public isThursday() : bool

Checks if the instance day is thursday.

Return values
bool —

isTuesday()

public isTuesday() : bool

Checks if the instance day is tuesday.

Return values
bool —

isUtc()

public isUtc() : bool

Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.)

Return values
bool —

isValid()

public isValid() : bool

Check if the current instance is a valid date.

Return values
bool —

isWednesday()

public isWednesday() : bool

Checks if the instance day is wednesday.

Return values
bool —

longAbsoluteDiffForHumans()

public longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

longRelativeDiffForHumans()

public longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

longRelativeToNowDiffForHumans()

public longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

longRelativeToOtherDiffForHumans()

public longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

meridiem()

Return the meridiem of the current time in the current locale.

public meridiem([bool $isLower = false ]) : string
Parameters
$isLower : bool = false

if true, returns lowercase variant if available in the current locale.

Return values
string —

microsecondsUntil()

public microsecondsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

microsUntil()

public microsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

millenniaUntil()

public millenniaUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

millisecondsUntil()

public millisecondsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

millisUntil()

public millisUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

minutesUntil()

public minutesUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

monthsUntil()

public monthsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

nowWithSameTz()

Returns a present instance in the same timezone.

public nowWithSameTz() : static
Return values
static —

ordinal()

Return a property with its ordinal.

public ordinal(string $key[, string|null $period = null ]) : string
Parameters
$key : string
$period : string|null = null
Return values
string —

pluralUnit()

Returns standardized plural of a given singular/plural unit name (in English).

public static pluralUnit(string $unit) : string
Parameters
$unit : string
Return values
string —

quartersUntil()

public quartersUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

roundCenturies()

public roundCenturies(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance century with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundCentury()

public roundCentury(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance century with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundDay()

public roundDay(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance day with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundDays()

public roundDays(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance day with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundDecade()

public roundDecade(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance decade with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundDecades()

public roundDecades(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance decade with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundHour()

public roundHour(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance hour with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundHours()

public roundHours(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance hour with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMicrosecond()

public roundMicrosecond(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance microsecond with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMicroseconds()

public roundMicroseconds(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance microsecond with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMillennia()

public roundMillennia(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance millennium with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMillennium()

public roundMillennium(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance millennium with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMillisecond()

public roundMillisecond(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance millisecond with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMilliseconds()

public roundMilliseconds(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance millisecond with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMinute()

public roundMinute(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance minute with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMinutes()

public roundMinutes(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance minute with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMonth()

public roundMonth(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance month with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundMonths()

public roundMonths(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance month with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundQuarter()

public roundQuarter(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance quarter with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundQuarters()

public roundQuarters(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance quarter with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundSecond()

public roundSecond(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance second with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundSeconds()

public roundSeconds(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance second with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundYear()

public roundYear(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance year with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

roundYears()

public roundYears(float $precision = 1, string $function = "round") : CarbonImmutable

Round the current instance year with given precision using the given function.

Parameters
$precision = 1 : float
$function = "round" : string
Return values
CarbonImmutable —

secondsUntil()

public secondsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

set()

Set a part of the Carbon object

public set(string|array<string|int, mixed> $name[, string|int|DateTimeZone $value = null ]) : $this
Parameters
$name : string|array<string|int, mixed>
$value : string|int|DateTimeZone = null
Tags
throws
ImmutableException|UnknownSetterException
Return values
$this —

setDate()

Set the date with gregorian year, month and day numbers.

public setDate(int $year, int $month, int $day) : static
Parameters
$year : int
$month : int
$day : int
Tags
see
https://php.net/manual/en/datetime.setdate.php
Return values
static —

setDateFrom()

Set the year, month, and date for this instance to that of the passed instance.

public setDateFrom([Carbon|DateTimeInterface $date = null ]) : static
Parameters
$date : Carbon|DateTimeInterface = null

now if null

Return values
static —

setDateTime()

Set the date and time all together.

public setDateTime(int $year, int $month, int $day, int $hour, int $minute, int $second, int $microseconds) : static
Parameters
$year : int
$month : int
$day : int
$hour : int
$minute : int
$second : int
$microseconds : int
Return values
static —

setDateTimeFrom()

Set the date and time for this instance to that of the passed instance.

public setDateTimeFrom([Carbon|DateTimeInterface $date = null ]) : static
Parameters
$date : Carbon|DateTimeInterface = null
Return values
static —

setISODate()

Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.

public setISODate(int $year, int $week[, int $day = 1 ]) : static
Parameters
$year : int
$week : int
$day : int = 1
Tags
see
https://php.net/manual/en/datetime.setisodate.php
Return values
static —

setTime()

Resets the current time of the DateTime object to a different time.

public setTime(int $hour, int $minute, int $second, int $microseconds) : static
Parameters
$hour : int
$minute : int
$second : int
$microseconds : int
Tags
see
https://php.net/manual/en/datetime.settime.php
Return values
static —

setTimeFrom()

Set the hour, minute, second and microseconds for this instance to that of the passed instance.

public setTimeFrom([Carbon|DateTimeInterface $date = null ]) : static
Parameters
$date : Carbon|DateTimeInterface = null

now if null

Return values
static —

setTimeFromTimeString()

Set the time by time string.

public setTimeFromTimeString(string $time) : static
Parameters
$time : string
Return values
static —

setTimezone()

Set the instance's timezone from a string or object.

public setTimezone(DateTimeZone|string $value) : static
Parameters
$value : DateTimeZone|string
Return values
static —

setUnit()

Set specified unit to new given value.

public setUnit(string $unit[, int $value = null ]) : static
Parameters
$unit : string

year, month, day, hour, minute, second or microsecond

$value : int = null

new value for given unit

Return values
static —

setUnitNoOverflow()

Set any unit to a new value without overflowing current other unit given.

public setUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit) : static
Parameters
$valueUnit : string

unit name to modify

$value : int

new value for the input unit

$overflowUnit : string

unit name to not overflow

Return values
static —

setUtf8()

public static setUtf8(bool $utf8) : mixed
Parameters
$utf8 : bool
Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. You should rather use UTF-8 language packages on every machine.

Set if UTF8 will be used for localized date/time.

Return values
mixed —

setWeekendDays()

public static setWeekendDays(array<string|int, mixed> $days) : void
Parameters
$days : array<string|int, mixed>
Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. You should rather consider week-end is always saturday and sunday, and if you have some custom week-end days to handle, give to those days an other name and create a macro for them:

        ```
        Carbon::macro('isDayOff', function ($date) {
            return $date->isSunday() || $date->isMonday();
        });
        Carbon::macro('isNotDayOff', function ($date) {
            return !$date->isDayOff();
        });
        if ($someDate->isDayOff()) ...
        if ($someDate->isNotDayOff()) ...
        // Add 5 not-off days
        $count = 5;
        while ($someDate->isDayOff() || ($count-- > 0)) {
            $someDate->addDay();
        }
        ```

Set weekend days

Return values
void —

setWeekEndsAt()

public static setWeekEndsAt(int $day) : void
Parameters
$day : int
Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the start of week according to current locale selected and implicitly the end of week.

Set the last day of week

Return values
void —

setWeekStartsAt()

public static setWeekStartsAt(int $day) : void
Parameters
$day : int

week start day

Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the 'first_day_of_week' locale setting to change the start of week according to current locale selected and implicitly the end of week.

Set the first day of week

Return values
void —

shiftTimezone()

Set the instance's timezone from a string or object and add/subtract the offset difference.

public shiftTimezone(DateTimeZone|string $value) : static
Parameters
$value : DateTimeZone|string
Return values
static —

shortAbsoluteDiffForHumans()

public shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

shortRelativeDiffForHumans()

public shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

shortRelativeToNowDiffForHumans()

public shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

shortRelativeToOtherDiffForHumans()

public shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) : string

Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)

Parameters
$other = null : DateTimeInterface
$parts = 1 : int
Return values
string —

singularUnit()

Returns standardized singular of a given singular/plural unit name (in English).

public static singularUnit(string $unit) : string
Parameters
$unit : string
Return values
string —

subCenturiesNoOverflow()

public subCenturiesNoOverflow(int $value = 1) : CarbonImmutable

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subCenturiesWithNoOverflow()

public subCenturiesWithNoOverflow(int $value = 1) : CarbonImmutable

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subCenturiesWithoutOverflow()

public subCenturiesWithoutOverflow(int $value = 1) : CarbonImmutable

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subCenturiesWithOverflow()

public subCenturiesWithOverflow(int $value = 1) : CarbonImmutable

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subDecadesNoOverflow()

public subDecadesNoOverflow(int $value = 1) : CarbonImmutable

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subDecadesWithNoOverflow()

public subDecadesWithNoOverflow(int $value = 1) : CarbonImmutable

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subDecadesWithoutOverflow()

public subDecadesWithoutOverflow(int $value = 1) : CarbonImmutable

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subDecadesWithOverflow()

public subDecadesWithOverflow(int $value = 1) : CarbonImmutable

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMicroseconds()

public subMicroseconds(int $value = 1) : CarbonImmutable

Sub microseconds (the $value count passed in) to the instance (using date interval).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMillenniaNoOverflow()

public subMillenniaNoOverflow(int $value = 1) : CarbonImmutable

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMillenniaWithNoOverflow()

public subMillenniaWithNoOverflow(int $value = 1) : CarbonImmutable

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMillenniaWithoutOverflow()

public subMillenniaWithoutOverflow(int $value = 1) : CarbonImmutable

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMillenniaWithOverflow()

public subMillenniaWithOverflow(int $value = 1) : CarbonImmutable

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMilliseconds()

public subMilliseconds(int $value = 1) : CarbonImmutable

Sub milliseconds (the $value count passed in) to the instance (using date interval).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMonthsNoOverflow()

public subMonthsNoOverflow(int $value = 1) : CarbonImmutable

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMonthsWithNoOverflow()

public subMonthsWithNoOverflow(int $value = 1) : CarbonImmutable

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMonthsWithoutOverflow()

public subMonthsWithoutOverflow(int $value = 1) : CarbonImmutable

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subMonthsWithOverflow()

public subMonthsWithOverflow(int $value = 1) : CarbonImmutable

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subQuartersNoOverflow()

public subQuartersNoOverflow(int $value = 1) : CarbonImmutable

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subQuartersWithNoOverflow()

public subQuartersWithNoOverflow(int $value = 1) : CarbonImmutable

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subQuartersWithoutOverflow()

public subQuartersWithoutOverflow(int $value = 1) : CarbonImmutable

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subQuartersWithOverflow()

public subQuartersWithOverflow(int $value = 1) : CarbonImmutable

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subRealMicroseconds()

public subRealMicroseconds(int $value = 1) : CarbonImmutable

Sub microseconds (the $value count passed in) to the instance (using timestamp).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subRealMilliseconds()

public subRealMilliseconds(int $value = 1) : CarbonImmutable

Sub milliseconds (the $value count passed in) to the instance (using timestamp).

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subUnitNoOverflow()

Subtract any unit to a new value without overflowing current other unit given.

public subUnitNoOverflow(string $valueUnit, int $value, string $overflowUnit) : static
Parameters
$valueUnit : string

unit name to modify

$value : int

amount to subtract to the input unit

$overflowUnit : string

unit name to not overflow

Return values
static —

subYearsNoOverflow()

public subYearsNoOverflow(int $value = 1) : CarbonImmutable

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subYearsWithNoOverflow()

public subYearsWithNoOverflow(int $value = 1) : CarbonImmutable

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subYearsWithoutOverflow()

public subYearsWithoutOverflow(int $value = 1) : CarbonImmutable

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

subYearsWithOverflow()

public subYearsWithOverflow(int $value = 1) : CarbonImmutable

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
$value = 1 : int
Return values
CarbonImmutable —

timezone()

public timezone(DateTimeZone|string $value) : static
Parameters
$value : DateTimeZone|string
Tags
alias

setTimezone

Return values
static —

translatedFormat()

Format as ->format() do (using date replacements patterns from http://php.net/manual/fr/function.date.php) but translate words whenever possible (months, day names, etc.) using the current locale.

public translatedFormat(string $format) : string
Parameters
$format : string
Return values
string —

tz()

Set the timezone or returns the timezone name if no arguments passed.

public tz([DateTimeZone|string $value = null ]) : static|string
Parameters
$value : DateTimeZone|string = null
Return values
static|string —

utc()

Set the instance's timezone to UTC.

public utc() : static
Return values
static —

utcOffset()

Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.

public utcOffset([int|null $offset = null ]) : int|static
Parameters
$offset : int|null = null
Return values
int|static —

weekday()

Get/set the weekday from 0 (Sunday) to 6 (Saturday).

public weekday([int|null $value = null ]) : static|int
Parameters
$value : int|null = null

new value for weekday if using as setter.

Return values
static|int —

weeksUntil()

public weeksUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

yearsUntil()

public yearsUntil(mixed $endDate, int $factor = 1) : CarbonPeriod

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.

Parameters
$endDate : mixed
$factor = 1 : int
Return values
CarbonPeriod —

executeCallable()

protected executeCallable(mixed $macro, mixed ...$parameters) : mixed
Parameters
$macro : mixed
$parameters : mixed
Return values
mixed —

executeCallableWithContext()

protected executeCallableWithContext(mixed $macro, mixed ...$parameters) : mixed
Parameters
$macro : mixed
$parameters : mixed
Return values
mixed —

executeStaticCallable()

protected static executeStaticCallable(mixed $macro, mixed ...$parameters) : mixed
Parameters
$macro : mixed
$parameters : mixed
Return values
mixed —

expectDateTime()

Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface.

protected static expectDateTime(mixed $date[, string|array<string|int, mixed> $other = [] ]) : mixed
Parameters
$date : mixed
$other : string|array<string|int, mixed> = []
Tags
throws
InvalidTypeException
Return values
mixed —

getGenericMacros()

protected static getGenericMacros() : mixed
Return values
mixed —

getRangesByUnit()

List of minimum and maximums for each unit.

protected static getRangesByUnit() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getTranslatedFormByRegExp()

protected getTranslatedFormByRegExp(mixed $baseKey, mixed $keySuffix, mixed $context, mixed $subKey, mixed $defaultValue) : mixed
Parameters
$baseKey : mixed
$keySuffix : mixed
$context : mixed
$subKey : mixed
$defaultValue : mixed
Return values
mixed —

resolveCarbon()

Return the Carbon instance passed through, a now instance in the same timezone if null given or parse the input if string given.

protected resolveCarbon([Carbon|DateTimeInterface|string|null $date = null ]) : static
Parameters
$date : Carbon|DateTimeInterface|string|null = null
Return values
static —

safeCreateDateTimeZone()

Creates a DateTimeZone from a string, DateTimeZone or integer offset.

protected static safeCreateDateTimeZone(DateTimeZone|string|int|null $object[, DateTimeZone|string|int|null $objectDump = null ]) : CarbonTimeZone|false
Parameters
$object : DateTimeZone|string|int|null

original value to get CarbonTimeZone from it.

$objectDump : DateTimeZone|string|int|null = null

dump of the object for error messages.

Tags
throws
InvalidTimeZoneException
Return values
CarbonTimeZone|false —

Search results