Carbon
extends DateTime
in package
implements
CarbonInterface
Uses
Date
A simple API extension for DateTime.
<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() : Carbon
- addCenturiesNoOverflow() : Carbon
- addCenturiesWithNoOverflow() : Carbon
- addCenturiesWithoutOverflow() : Carbon
- addCenturiesWithOverflow() : Carbon
- addCentury() : Carbon
- addCenturyNoOverflow() : Carbon
- addCenturyWithNoOverflow() : Carbon
- addCenturyWithoutOverflow() : Carbon
- addCenturyWithOverflow() : Carbon
- addDay() : Carbon
- addDays() : Carbon
- addDecade() : Carbon
- addDecadeNoOverflow() : Carbon
- addDecades() : Carbon
- addDecadesNoOverflow() : Carbon
- addDecadesWithNoOverflow() : Carbon
- addDecadesWithoutOverflow() : Carbon
- addDecadesWithOverflow() : Carbon
- addDecadeWithNoOverflow() : Carbon
- addDecadeWithoutOverflow() : Carbon
- addDecadeWithOverflow() : Carbon
- addHour() : Carbon
- addHours() : Carbon
- addMicro() : Carbon
- addMicros() : Carbon
- addMicrosecond() : Carbon
- addMicroseconds() : Carbon
- addMillennia() : Carbon
- addMillenniaNoOverflow() : Carbon
- addMillenniaWithNoOverflow() : Carbon
- addMillenniaWithoutOverflow() : Carbon
- addMillenniaWithOverflow() : Carbon
- addMillennium() : Carbon
- addMillenniumNoOverflow() : Carbon
- addMillenniumWithNoOverflow() : Carbon
- addMillenniumWithoutOverflow() : Carbon
- addMillenniumWithOverflow() : Carbon
- addMilli() : Carbon
- addMillis() : Carbon
- addMillisecond() : Carbon
- addMilliseconds() : Carbon
- addMinute() : Carbon
- addMinutes() : Carbon
- addMonth() : Carbon
- addMonthNoOverflow() : Carbon
- addMonths() : Carbon
- addMonthsNoOverflow() : Carbon
- addMonthsWithNoOverflow() : Carbon
- addMonthsWithoutOverflow() : Carbon
- addMonthsWithOverflow() : Carbon
- addMonthWithNoOverflow() : Carbon
- addMonthWithoutOverflow() : Carbon
- addMonthWithOverflow() : Carbon
- addQuarter() : Carbon
- addQuarterNoOverflow() : Carbon
- addQuarters() : Carbon
- addQuartersNoOverflow() : Carbon
- addQuartersWithNoOverflow() : Carbon
- addQuartersWithoutOverflow() : Carbon
- addQuartersWithOverflow() : Carbon
- addQuarterWithNoOverflow() : Carbon
- addQuarterWithoutOverflow() : Carbon
- addQuarterWithOverflow() : Carbon
- addRealCenturies() : Carbon
- addRealCentury() : Carbon
- addRealDay() : Carbon
- addRealDays() : Carbon
- addRealDecade() : Carbon
- addRealDecades() : Carbon
- addRealHour() : Carbon
- addRealHours() : Carbon
- addRealMicro() : Carbon
- addRealMicros() : Carbon
- addRealMicrosecond() : Carbon
- addRealMicroseconds() : Carbon
- addRealMillennia() : Carbon
- addRealMillennium() : Carbon
- addRealMilli() : Carbon
- addRealMillis() : Carbon
- addRealMillisecond() : Carbon
- addRealMilliseconds() : Carbon
- addRealMinute() : Carbon
- addRealMinutes() : Carbon
- addRealMonth() : Carbon
- addRealMonths() : Carbon
- addRealQuarter() : Carbon
- addRealQuarters() : Carbon
- addRealSecond() : Carbon
- addRealSeconds() : Carbon
- addRealWeek() : Carbon
- addRealWeeks() : Carbon
- addRealYear() : Carbon
- addRealYears() : Carbon
- addSecond() : Carbon
- addSeconds() : Carbon
- addUnitNoOverflow() : static
- Add any unit to a new value without overflowing current other unit given.
- addWeek() : Carbon
- addWeekday() : Carbon
- addWeekdays() : Carbon
- addWeeks() : Carbon
- addYear() : Carbon
- addYearNoOverflow() : Carbon
- addYears() : Carbon
- addYearsNoOverflow() : Carbon
- addYearsWithNoOverflow() : Carbon
- addYearsWithoutOverflow() : Carbon
- addYearsWithOverflow() : Carbon
- addYearWithNoOverflow() : Carbon
- addYearWithoutOverflow() : Carbon
- addYearWithOverflow() : Carbon
- 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() : Carbon
- ceilCentury() : Carbon
- ceilDay() : Carbon
- ceilDays() : Carbon
- ceilDecade() : Carbon
- ceilDecades() : Carbon
- ceilHour() : Carbon
- ceilHours() : Carbon
- ceilMicrosecond() : Carbon
- ceilMicroseconds() : Carbon
- ceilMillennia() : Carbon
- ceilMillennium() : Carbon
- ceilMillisecond() : Carbon
- ceilMilliseconds() : Carbon
- ceilMinute() : Carbon
- ceilMinutes() : Carbon
- ceilMonth() : Carbon
- ceilMonths() : Carbon
- ceilQuarter() : Carbon
- ceilQuarters() : Carbon
- ceilSecond() : Carbon
- ceilSeconds() : Carbon
- ceilYear() : Carbon
- ceilYears() : Carbon
- centuriesUntil() : CarbonPeriod
- clone() : static
- copy() : static
- Get a copy of the instance.
- createFromFormat() : static|false
- Create a Carbon instance from a specific format.
- createFromImmutable() : Carbon
- day() : Carbon
- dayOfYear() : static|int
- Get/set the day of year.
- days() : Carbon
- daysUntil() : CarbonPeriod
- decadesUntil() : CarbonPeriod
- floorCenturies() : Carbon
- floorCentury() : Carbon
- floorDay() : Carbon
- floorDays() : Carbon
- floorDecade() : Carbon
- floorDecades() : Carbon
- floorHour() : Carbon
- floorHours() : Carbon
- floorMicrosecond() : Carbon
- floorMicroseconds() : Carbon
- floorMillennia() : Carbon
- floorMillennium() : Carbon
- floorMillisecond() : Carbon
- floorMilliseconds() : Carbon
- floorMinute() : Carbon
- floorMinutes() : Carbon
- floorMonth() : Carbon
- floorMonths() : Carbon
- floorQuarter() : Carbon
- floorQuarters() : Carbon
- floorSecond() : Carbon
- floorSeconds() : Carbon
- floorYear() : Carbon
- floorYears() : Carbon
- 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() : Carbon
- hours() : Carbon
- 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
- isMutable() : bool
- Returns true if the current class/instance is mutable.
- 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() : Carbon
- micros() : Carbon
- microsecond() : Carbon
- microseconds() : Carbon
- microsecondsUntil() : CarbonPeriod
- microsUntil() : CarbonPeriod
- millenniaUntil() : CarbonPeriod
- milli() : Carbon
- millis() : Carbon
- millisecond() : Carbon
- milliseconds() : Carbon
- millisecondsUntil() : CarbonPeriod
- millisUntil() : CarbonPeriod
- minute() : Carbon
- minutes() : Carbon
- minutesUntil() : CarbonPeriod
- month() : Carbon
- months() : Carbon
- 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() : Carbon
- roundCentury() : Carbon
- roundDay() : Carbon
- roundDays() : Carbon
- roundDecade() : Carbon
- roundDecades() : Carbon
- roundHour() : Carbon
- roundHours() : Carbon
- roundMicrosecond() : Carbon
- roundMicroseconds() : Carbon
- roundMillennia() : Carbon
- roundMillennium() : Carbon
- roundMillisecond() : Carbon
- roundMilliseconds() : Carbon
- roundMinute() : Carbon
- roundMinutes() : Carbon
- roundMonth() : Carbon
- roundMonths() : Carbon
- roundQuarter() : Carbon
- roundQuarters() : Carbon
- roundSecond() : Carbon
- roundSeconds() : Carbon
- roundYear() : Carbon
- roundYears() : Carbon
- second() : Carbon
- seconds() : Carbon
- 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() : Carbon
- setDays() : Carbon
- setHour() : Carbon
- setHours() : Carbon
- setISODate() : static
- Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
- setMicro() : Carbon
- setMicros() : Carbon
- setMicrosecond() : Carbon
- setMicroseconds() : Carbon
- setMilli() : Carbon
- setMillis() : Carbon
- setMillisecond() : Carbon
- setMilliseconds() : Carbon
- setMinute() : Carbon
- setMinutes() : Carbon
- setMonth() : Carbon
- setMonths() : Carbon
- setSecond() : Carbon
- setSeconds() : Carbon
- 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() : Carbon
- setYears() : Carbon
- 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() : Carbon
- subCenturiesNoOverflow() : Carbon
- subCenturiesWithNoOverflow() : Carbon
- subCenturiesWithoutOverflow() : Carbon
- subCenturiesWithOverflow() : Carbon
- subCentury() : Carbon
- subCenturyNoOverflow() : Carbon
- subCenturyWithNoOverflow() : Carbon
- subCenturyWithoutOverflow() : Carbon
- subCenturyWithOverflow() : Carbon
- subDay() : Carbon
- subDays() : Carbon
- subDecade() : Carbon
- subDecadeNoOverflow() : Carbon
- subDecades() : Carbon
- subDecadesNoOverflow() : Carbon
- subDecadesWithNoOverflow() : Carbon
- subDecadesWithoutOverflow() : Carbon
- subDecadesWithOverflow() : Carbon
- subDecadeWithNoOverflow() : Carbon
- subDecadeWithoutOverflow() : Carbon
- subDecadeWithOverflow() : Carbon
- subHour() : Carbon
- subHours() : Carbon
- subMicro() : Carbon
- subMicros() : Carbon
- subMicrosecond() : Carbon
- subMicroseconds() : Carbon
- subMillennia() : Carbon
- subMillenniaNoOverflow() : Carbon
- subMillenniaWithNoOverflow() : Carbon
- subMillenniaWithoutOverflow() : Carbon
- subMillenniaWithOverflow() : Carbon
- subMillennium() : Carbon
- subMillenniumNoOverflow() : Carbon
- subMillenniumWithNoOverflow() : Carbon
- subMillenniumWithoutOverflow() : Carbon
- subMillenniumWithOverflow() : Carbon
- subMilli() : Carbon
- subMillis() : Carbon
- subMillisecond() : Carbon
- subMilliseconds() : Carbon
- subMinute() : Carbon
- subMinutes() : Carbon
- subMonth() : Carbon
- subMonthNoOverflow() : Carbon
- subMonths() : Carbon
- subMonthsNoOverflow() : Carbon
- subMonthsWithNoOverflow() : Carbon
- subMonthsWithoutOverflow() : Carbon
- subMonthsWithOverflow() : Carbon
- subMonthWithNoOverflow() : Carbon
- subMonthWithoutOverflow() : Carbon
- subMonthWithOverflow() : Carbon
- subQuarter() : Carbon
- subQuarterNoOverflow() : Carbon
- subQuarters() : Carbon
- subQuartersNoOverflow() : Carbon
- subQuartersWithNoOverflow() : Carbon
- subQuartersWithoutOverflow() : Carbon
- subQuartersWithOverflow() : Carbon
- subQuarterWithNoOverflow() : Carbon
- subQuarterWithoutOverflow() : Carbon
- subQuarterWithOverflow() : Carbon
- subRealCenturies() : Carbon
- subRealCentury() : Carbon
- subRealDay() : Carbon
- subRealDays() : Carbon
- subRealDecade() : Carbon
- subRealDecades() : Carbon
- subRealHour() : Carbon
- subRealHours() : Carbon
- subRealMicro() : Carbon
- subRealMicros() : Carbon
- subRealMicrosecond() : Carbon
- subRealMicroseconds() : Carbon
- subRealMillennia() : Carbon
- subRealMillennium() : Carbon
- subRealMilli() : Carbon
- subRealMillis() : Carbon
- subRealMillisecond() : Carbon
- subRealMilliseconds() : Carbon
- subRealMinute() : Carbon
- subRealMinutes() : Carbon
- subRealMonth() : Carbon
- subRealMonths() : Carbon
- subRealQuarter() : Carbon
- subRealQuarters() : Carbon
- subRealSecond() : Carbon
- subRealSeconds() : Carbon
- subRealWeek() : Carbon
- subRealWeeks() : Carbon
- subRealYear() : Carbon
- subRealYears() : Carbon
- subSecond() : Carbon
- subSeconds() : Carbon
- subUnitNoOverflow() : static
- Subtract any unit to a new value without overflowing current other unit given.
- subWeek() : Carbon
- subWeekday() : Carbon
- subWeekdays() : Carbon
- subWeeks() : Carbon
- subYear() : Carbon
- subYearNoOverflow() : Carbon
- subYears() : Carbon
- subYearsNoOverflow() : Carbon
- subYearsWithNoOverflow() : Carbon
- subYearsWithoutOverflow() : Carbon
- subYearsWithOverflow() : Carbon
- subYearWithNoOverflow() : Carbon
- subYearWithoutOverflow() : Carbon
- subYearWithOverflow() : Carbon
- 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() : Carbon
- years() : Carbon
- 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
$age
public
int
$age
does a diffInYears() with default parameters
$century read-only
public
int
$century
the century of this instance
$day
public
int
$day
$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)
$dayOfYear
public
int
$dayOfYear
1 through 366
$daysInMonth read-only
public
int
$daysInMonth
number of days in the given month
$daysInYear read-only
public
int
$daysInYear
365 or 366
$decade read-only
public
int
$decade
the decade of this instance
$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
$englishMonth
public
string
$englishMonth
the month in English
$firstWeekDay read-only
public
int
$firstWeekDay
0 through 6
$hour
public
int
$hour
$isoWeek
public
int
$isoWeek
1 through 53
$isoWeeksInYear read-only
public
int
$isoWeeksInYear
51 through 53
$isoWeekYear
public
int
$isoWeekYear
year according to ISO week format
$lastWeekDay read-only
public
int
$lastWeekDay
0 through 6
$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
$micro
public
int
$micro
$microsecond
public
int
$microsecond
$millennium read-only
public
int
$millennium
the millennium of this instance
$milli
public
int
$milli
$millisecond
public
int
$millisecond
$milliseconds
public
int
$milliseconds
$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
$minute
public
int
$minute
$month
public
int
$month
$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
$offset
public
int
$offset
the timezone offset in seconds from UTC
$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
$second
public
int
$second
$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
$timestamp
public
int
$timestamp
seconds since the Unix Epoch
$timezone
public
CarbonTimeZone
$timezone
the current timezone
$timezoneAbbreviatedName read-only
public
string
$timezoneAbbreviatedName
the current timezone abbreviated name
$timezoneName read-only
public
string
$timezoneName
the current timezone name
$tz
public
CarbonTimeZone
$tz
alias of $timezone
$tzAbbrName read-only
public
string
$tzAbbrName
alias of $timezoneAbbreviatedName
$tzName read-only
public
string
$tzName
alias of $timezoneName
$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
$week
public
int
$week
1 through 53
$weekNumberInMonth read-only
public
int
$weekNumberInMonth
1 through 5
$weekOfMonth read-only
public
int
$weekOfMonth
1 through 5
$weekOfYear read-only
public
int
$weekOfYear
ISO-8601 week number of year, weeks starting on Monday
$weeksInYear read-only
public
int
$weeksInYear
51 through 53
$weekYear
public
int
$weekYear
year according to week format
$year
public
int
$year
$yearIso
public
int
$yearIso
$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
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
Return values
mixed —__get()
Get a part of the Carbon object
public
__get(string $name) : string|int|bool|DateTimeZone|null
Parameters
- $name : string
Tags
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
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 —addCenturies()
public
addCenturies(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addCenturiesNoOverflow()
public
addCenturiesNoOverflow(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addCenturiesWithNoOverflow()
public
addCenturiesWithNoOverflow(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addCenturiesWithoutOverflow()
public
addCenturiesWithoutOverflow(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addCenturiesWithOverflow()
public
addCenturiesWithOverflow(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addCentury()
public
addCentury() : Carbon
Add one century to the instance (using date interval).
Return values
Carbon —addCenturyNoOverflow()
public
addCenturyNoOverflow() : Carbon
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addCenturyWithNoOverflow()
public
addCenturyWithNoOverflow() : Carbon
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addCenturyWithoutOverflow()
public
addCenturyWithoutOverflow() : Carbon
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addCenturyWithOverflow()
public
addCenturyWithOverflow() : Carbon
Add one century to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —addDay()
public
addDay() : Carbon
Add one day to the instance (using date interval).
Return values
Carbon —addDays()
public
addDays(int $value = 1) : Carbon
Add days (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addDecade()
public
addDecade() : Carbon
Add one decade to the instance (using date interval).
Return values
Carbon —addDecadeNoOverflow()
public
addDecadeNoOverflow() : Carbon
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addDecades()
public
addDecades(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addDecadesNoOverflow()
public
addDecadesNoOverflow(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addDecadesWithNoOverflow()
public
addDecadesWithNoOverflow(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addDecadesWithoutOverflow()
public
addDecadesWithoutOverflow(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addDecadesWithOverflow()
public
addDecadesWithOverflow(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addDecadeWithNoOverflow()
public
addDecadeWithNoOverflow() : Carbon
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addDecadeWithoutOverflow()
public
addDecadeWithoutOverflow() : Carbon
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addDecadeWithOverflow()
public
addDecadeWithOverflow() : Carbon
Add one decade to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —addHour()
public
addHour() : Carbon
Add one hour to the instance (using date interval).
Return values
Carbon —addHours()
public
addHours(int $value = 1) : Carbon
Add hours (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMicro()
public
addMicro() : Carbon
Add one microsecond to the instance (using date interval).
Return values
Carbon —addMicros()
public
addMicros(int $value = 1) : Carbon
Add microseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMicrosecond()
public
addMicrosecond() : Carbon
Add one microsecond to the instance (using date interval).
Return values
Carbon —addMicroseconds()
public
addMicroseconds(int $value = 1) : Carbon
Add microseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMillennia()
public
addMillennia(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMillenniaNoOverflow()
public
addMillenniaNoOverflow(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMillenniaWithNoOverflow()
public
addMillenniaWithNoOverflow(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMillenniaWithoutOverflow()
public
addMillenniaWithoutOverflow(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMillenniaWithOverflow()
public
addMillenniaWithOverflow(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addMillennium()
public
addMillennium() : Carbon
Add one millennium to the instance (using date interval).
Return values
Carbon —addMillenniumNoOverflow()
public
addMillenniumNoOverflow() : Carbon
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMillenniumWithNoOverflow()
public
addMillenniumWithNoOverflow() : Carbon
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMillenniumWithoutOverflow()
public
addMillenniumWithoutOverflow() : Carbon
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMillenniumWithOverflow()
public
addMillenniumWithOverflow() : Carbon
Add one millennium to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —addMilli()
public
addMilli() : Carbon
Add one millisecond to the instance (using date interval).
Return values
Carbon —addMillis()
public
addMillis(int $value = 1) : Carbon
Add milliseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMillisecond()
public
addMillisecond() : Carbon
Add one millisecond to the instance (using date interval).
Return values
Carbon —addMilliseconds()
public
addMilliseconds(int $value = 1) : Carbon
Add milliseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMinute()
public
addMinute() : Carbon
Add one minute to the instance (using date interval).
Return values
Carbon —addMinutes()
public
addMinutes(int $value = 1) : Carbon
Add minutes (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMonth()
public
addMonth() : Carbon
Add one month to the instance (using date interval).
Return values
Carbon —addMonthNoOverflow()
public
addMonthNoOverflow() : Carbon
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMonths()
public
addMonths(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addMonthsNoOverflow()
public
addMonthsNoOverflow(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMonthsWithNoOverflow()
public
addMonthsWithNoOverflow(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMonthsWithoutOverflow()
public
addMonthsWithoutOverflow(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addMonthsWithOverflow()
public
addMonthsWithOverflow(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addMonthWithNoOverflow()
public
addMonthWithNoOverflow() : Carbon
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMonthWithoutOverflow()
public
addMonthWithoutOverflow() : Carbon
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addMonthWithOverflow()
public
addMonthWithOverflow() : Carbon
Add one month to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —addQuarter()
public
addQuarter() : Carbon
Add one quarter to the instance (using date interval).
Return values
Carbon —addQuarterNoOverflow()
public
addQuarterNoOverflow() : Carbon
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addQuarters()
public
addQuarters(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addQuartersNoOverflow()
public
addQuartersNoOverflow(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addQuartersWithNoOverflow()
public
addQuartersWithNoOverflow(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addQuartersWithoutOverflow()
public
addQuartersWithoutOverflow(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addQuartersWithOverflow()
public
addQuartersWithOverflow(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addQuarterWithNoOverflow()
public
addQuarterWithNoOverflow() : Carbon
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addQuarterWithoutOverflow()
public
addQuarterWithoutOverflow() : Carbon
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addQuarterWithOverflow()
public
addQuarterWithOverflow() : Carbon
Add one quarter to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —addRealCenturies()
public
addRealCenturies(int $value = 1) : Carbon
Add centuries (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealCentury()
public
addRealCentury() : Carbon
Add one century to the instance (using timestamp).
Return values
Carbon —addRealDay()
public
addRealDay() : Carbon
Add one day to the instance (using timestamp).
Return values
Carbon —addRealDays()
public
addRealDays(int $value = 1) : Carbon
Add days (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealDecade()
public
addRealDecade() : Carbon
Add one decade to the instance (using timestamp).
Return values
Carbon —addRealDecades()
public
addRealDecades(int $value = 1) : Carbon
Add decades (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealHour()
public
addRealHour() : Carbon
Add one hour to the instance (using timestamp).
Return values
Carbon —addRealHours()
public
addRealHours(int $value = 1) : Carbon
Add hours (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMicro()
public
addRealMicro() : Carbon
Add one microsecond to the instance (using timestamp).
Return values
Carbon —addRealMicros()
public
addRealMicros(int $value = 1) : Carbon
Add microseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMicrosecond()
public
addRealMicrosecond() : Carbon
Add one microsecond to the instance (using timestamp).
Return values
Carbon —addRealMicroseconds()
public
addRealMicroseconds(int $value = 1) : Carbon
Add microseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMillennia()
public
addRealMillennia(int $value = 1) : Carbon
Add millennia (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMillennium()
public
addRealMillennium() : Carbon
Add one millennium to the instance (using timestamp).
Return values
Carbon —addRealMilli()
public
addRealMilli() : Carbon
Add one millisecond to the instance (using timestamp).
Return values
Carbon —addRealMillis()
public
addRealMillis(int $value = 1) : Carbon
Add milliseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMillisecond()
public
addRealMillisecond() : Carbon
Add one millisecond to the instance (using timestamp).
Return values
Carbon —addRealMilliseconds()
public
addRealMilliseconds(int $value = 1) : Carbon
Add milliseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMinute()
public
addRealMinute() : Carbon
Add one minute to the instance (using timestamp).
Return values
Carbon —addRealMinutes()
public
addRealMinutes(int $value = 1) : Carbon
Add minutes (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealMonth()
public
addRealMonth() : Carbon
Add one month to the instance (using timestamp).
Return values
Carbon —addRealMonths()
public
addRealMonths(int $value = 1) : Carbon
Add months (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealQuarter()
public
addRealQuarter() : Carbon
Add one quarter to the instance (using timestamp).
Return values
Carbon —addRealQuarters()
public
addRealQuarters(int $value = 1) : Carbon
Add quarters (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealSecond()
public
addRealSecond() : Carbon
Add one second to the instance (using timestamp).
Return values
Carbon —addRealSeconds()
public
addRealSeconds(int $value = 1) : Carbon
Add seconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealWeek()
public
addRealWeek() : Carbon
Add one week to the instance (using timestamp).
Return values
Carbon —addRealWeeks()
public
addRealWeeks(int $value = 1) : Carbon
Add weeks (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addRealYear()
public
addRealYear() : Carbon
Add one year to the instance (using timestamp).
Return values
Carbon —addRealYears()
public
addRealYears(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —addSecond()
public
addSecond() : Carbon
Add one second to the instance (using date interval).
Return values
Carbon —addSeconds()
public
addSeconds(int $value = 1) : Carbon
Add seconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —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 —addWeek()
public
addWeek() : Carbon
Add one week to the instance (using date interval).
Return values
Carbon —addWeekday()
public
addWeekday() : Carbon
Add one weekday to the instance (using date interval).
Return values
Carbon —addWeekdays()
public
addWeekdays(int $value = 1) : Carbon
Add weekdays (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addWeeks()
public
addWeeks(int $value = 1) : Carbon
Add weeks (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addYear()
public
addYear() : Carbon
Add one year to the instance (using date interval).
Return values
Carbon —addYearNoOverflow()
public
addYearNoOverflow() : Carbon
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addYears()
public
addYears(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —addYearsNoOverflow()
public
addYearsNoOverflow(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addYearsWithNoOverflow()
public
addYearsWithNoOverflow(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addYearsWithoutOverflow()
public
addYearsWithoutOverflow(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —addYearsWithOverflow()
public
addYearsWithOverflow(int $value = 1) : Carbon
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —addYearWithNoOverflow()
public
addYearWithNoOverflow() : Carbon
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addYearWithoutOverflow()
public
addYearWithoutOverflow() : Carbon
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —addYearWithOverflow()
public
addYearWithOverflow() : Carbon
Add one year to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —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 —ceilCenturies()
public
ceilCenturies(float $precision = 1) : Carbon
Ceil the current instance century with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilCentury()
public
ceilCentury(float $precision = 1) : Carbon
Ceil the current instance century with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilDay()
public
ceilDay(float $precision = 1) : Carbon
Ceil the current instance day with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilDays()
public
ceilDays(float $precision = 1) : Carbon
Ceil the current instance day with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilDecade()
public
ceilDecade(float $precision = 1) : Carbon
Ceil the current instance decade with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilDecades()
public
ceilDecades(float $precision = 1) : Carbon
Ceil the current instance decade with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilHour()
public
ceilHour(float $precision = 1) : Carbon
Ceil the current instance hour with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilHours()
public
ceilHours(float $precision = 1) : Carbon
Ceil the current instance hour with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMicrosecond()
public
ceilMicrosecond(float $precision = 1) : Carbon
Ceil the current instance microsecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMicroseconds()
public
ceilMicroseconds(float $precision = 1) : Carbon
Ceil the current instance microsecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMillennia()
public
ceilMillennia(float $precision = 1) : Carbon
Ceil the current instance millennium with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMillennium()
public
ceilMillennium(float $precision = 1) : Carbon
Ceil the current instance millennium with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMillisecond()
public
ceilMillisecond(float $precision = 1) : Carbon
Ceil the current instance millisecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMilliseconds()
public
ceilMilliseconds(float $precision = 1) : Carbon
Ceil the current instance millisecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMinute()
public
ceilMinute(float $precision = 1) : Carbon
Ceil the current instance minute with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMinutes()
public
ceilMinutes(float $precision = 1) : Carbon
Ceil the current instance minute with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMonth()
public
ceilMonth(float $precision = 1) : Carbon
Ceil the current instance month with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilMonths()
public
ceilMonths(float $precision = 1) : Carbon
Ceil the current instance month with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilQuarter()
public
ceilQuarter(float $precision = 1) : Carbon
Ceil the current instance quarter with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilQuarters()
public
ceilQuarters(float $precision = 1) : Carbon
Ceil the current instance quarter with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilSecond()
public
ceilSecond(float $precision = 1) : Carbon
Ceil the current instance second with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilSeconds()
public
ceilSeconds(float $precision = 1) : Carbon
Ceil the current instance second with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilYear()
public
ceilYear(float $precision = 1) : Carbon
Ceil the current instance year with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —ceilYears()
public
ceilYears(float $precision = 1) : Carbon
Ceil the current instance year with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —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
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 Carbon object according to the specified format.
Parameters
- $format : string
-
Datetime format
- $time : string
- $timezone = null : string|DateTimeZone
Return values
static|false —createFromImmutable()
public
static createFromImmutable(DateTimeImmutable $dateTime) : Carbon
Create a new Carbon object from an immutable date.
Parameters
- $dateTime : DateTimeImmutable
Return values
Carbon —day()
public
day(int $value) : Carbon
Set current instance day to the given value.
Parameters
- $value : int
Return values
Carbon —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 —days()
public
days(int $value) : Carbon
Set current instance day to the given value.
Parameters
- $value : int
Return values
Carbon —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 —floorCenturies()
public
floorCenturies(float $precision = 1) : Carbon
Truncate the current instance century with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorCentury()
public
floorCentury(float $precision = 1) : Carbon
Truncate the current instance century with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorDay()
public
floorDay(float $precision = 1) : Carbon
Truncate the current instance day with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorDays()
public
floorDays(float $precision = 1) : Carbon
Truncate the current instance day with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorDecade()
public
floorDecade(float $precision = 1) : Carbon
Truncate the current instance decade with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorDecades()
public
floorDecades(float $precision = 1) : Carbon
Truncate the current instance decade with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorHour()
public
floorHour(float $precision = 1) : Carbon
Truncate the current instance hour with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorHours()
public
floorHours(float $precision = 1) : Carbon
Truncate the current instance hour with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMicrosecond()
public
floorMicrosecond(float $precision = 1) : Carbon
Truncate the current instance microsecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMicroseconds()
public
floorMicroseconds(float $precision = 1) : Carbon
Truncate the current instance microsecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMillennia()
public
floorMillennia(float $precision = 1) : Carbon
Truncate the current instance millennium with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMillennium()
public
floorMillennium(float $precision = 1) : Carbon
Truncate the current instance millennium with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMillisecond()
public
floorMillisecond(float $precision = 1) : Carbon
Truncate the current instance millisecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMilliseconds()
public
floorMilliseconds(float $precision = 1) : Carbon
Truncate the current instance millisecond with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMinute()
public
floorMinute(float $precision = 1) : Carbon
Truncate the current instance minute with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMinutes()
public
floorMinutes(float $precision = 1) : Carbon
Truncate the current instance minute with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMonth()
public
floorMonth(float $precision = 1) : Carbon
Truncate the current instance month with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorMonths()
public
floorMonths(float $precision = 1) : Carbon
Truncate the current instance month with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorQuarter()
public
floorQuarter(float $precision = 1) : Carbon
Truncate the current instance quarter with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorQuarters()
public
floorQuarters(float $precision = 1) : Carbon
Truncate the current instance quarter with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorSecond()
public
floorSecond(float $precision = 1) : Carbon
Truncate the current instance second with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorSeconds()
public
floorSeconds(float $precision = 1) : Carbon
Truncate the current instance second with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorYear()
public
floorYear(float $precision = 1) : Carbon
Truncate the current instance year with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —floorYears()
public
floorYears(float $precision = 1) : Carbon
Truncate the current instance year with given precision.
Parameters
- $precision = 1 : float
Return values
Carbon —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
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 —getTimezone()
Get the TimeZone associated with the Carbon instance (as CarbonTimeZone).
public
getTimezone() : CarbonTimeZone
Tags
Return values
CarbonTimeZone —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
hour()
public
hour(int $value) : Carbon
Set current instance hour to the given value.
Parameters
- $value : int
Return values
Carbon —hours()
public
hours(int $value) : Carbon
Set current instance hour to the given value.
Parameters
- $value : int
Return values
Carbon —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 —isMutable()
Returns true if the current class/instance is mutable.
public
static isMutable() : bool
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 —micro()
public
micro(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —micros()
public
micros(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —microsecond()
public
microsecond(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —microseconds()
public
microseconds(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —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 —milli()
public
milli(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —millis()
public
millis(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —millisecond()
public
millisecond(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —milliseconds()
public
milliseconds(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —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 —minute()
public
minute(int $value) : Carbon
Set current instance minute to the given value.
Parameters
- $value : int
Return values
Carbon —minutes()
public
minutes(int $value) : Carbon
Set current instance minute to the given value.
Parameters
- $value : int
Return values
Carbon —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 —month()
public
month(int $value) : Carbon
Set current instance month to the given value.
Parameters
- $value : int
Return values
Carbon —months()
public
months(int $value) : Carbon
Set current instance month to the given value.
Parameters
- $value : int
Return values
Carbon —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") : Carbon
Round the current instance century with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundCentury()
public
roundCentury(float $precision = 1, string $function = "round") : Carbon
Round the current instance century with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundDay()
public
roundDay(float $precision = 1, string $function = "round") : Carbon
Round the current instance day with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundDays()
public
roundDays(float $precision = 1, string $function = "round") : Carbon
Round the current instance day with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundDecade()
public
roundDecade(float $precision = 1, string $function = "round") : Carbon
Round the current instance decade with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundDecades()
public
roundDecades(float $precision = 1, string $function = "round") : Carbon
Round the current instance decade with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundHour()
public
roundHour(float $precision = 1, string $function = "round") : Carbon
Round the current instance hour with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundHours()
public
roundHours(float $precision = 1, string $function = "round") : Carbon
Round the current instance hour with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMicrosecond()
public
roundMicrosecond(float $precision = 1, string $function = "round") : Carbon
Round the current instance microsecond with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMicroseconds()
public
roundMicroseconds(float $precision = 1, string $function = "round") : Carbon
Round the current instance microsecond with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMillennia()
public
roundMillennia(float $precision = 1, string $function = "round") : Carbon
Round the current instance millennium with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMillennium()
public
roundMillennium(float $precision = 1, string $function = "round") : Carbon
Round the current instance millennium with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMillisecond()
public
roundMillisecond(float $precision = 1, string $function = "round") : Carbon
Round the current instance millisecond with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMilliseconds()
public
roundMilliseconds(float $precision = 1, string $function = "round") : Carbon
Round the current instance millisecond with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMinute()
public
roundMinute(float $precision = 1, string $function = "round") : Carbon
Round the current instance minute with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMinutes()
public
roundMinutes(float $precision = 1, string $function = "round") : Carbon
Round the current instance minute with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMonth()
public
roundMonth(float $precision = 1, string $function = "round") : Carbon
Round the current instance month with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundMonths()
public
roundMonths(float $precision = 1, string $function = "round") : Carbon
Round the current instance month with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundQuarter()
public
roundQuarter(float $precision = 1, string $function = "round") : Carbon
Round the current instance quarter with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundQuarters()
public
roundQuarters(float $precision = 1, string $function = "round") : Carbon
Round the current instance quarter with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundSecond()
public
roundSecond(float $precision = 1, string $function = "round") : Carbon
Round the current instance second with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundSeconds()
public
roundSeconds(float $precision = 1, string $function = "round") : Carbon
Round the current instance second with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundYear()
public
roundYear(float $precision = 1, string $function = "round") : Carbon
Round the current instance year with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —roundYears()
public
roundYears(float $precision = 1, string $function = "round") : Carbon
Round the current instance year with given precision using the given function.
Parameters
- $precision = 1 : float
- $function = "round" : string
Return values
Carbon —second()
public
second(int $value) : Carbon
Set current instance second to the given value.
Parameters
- $value : int
Return values
Carbon —seconds()
public
seconds(int $value) : Carbon
Set current instance second to the given value.
Parameters
- $value : int
Return values
Carbon —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
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
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 —setDay()
public
setDay(int $value) : Carbon
Set current instance day to the given value.
Parameters
- $value : int
Return values
Carbon —setDays()
public
setDays(int $value) : Carbon
Set current instance day to the given value.
Parameters
- $value : int
Return values
Carbon —setHour()
public
setHour(int $value) : Carbon
Set current instance hour to the given value.
Parameters
- $value : int
Return values
Carbon —setHours()
public
setHours(int $value) : Carbon
Set current instance hour to the given value.
Parameters
- $value : int
Return values
Carbon —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
Return values
static —setMicro()
public
setMicro(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMicros()
public
setMicros(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMicrosecond()
public
setMicrosecond(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMicroseconds()
public
setMicroseconds(int $value) : Carbon
Set current instance microsecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMilli()
public
setMilli(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMillis()
public
setMillis(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMillisecond()
public
setMillisecond(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMilliseconds()
public
setMilliseconds(int $value) : Carbon
Set current instance millisecond to the given value.
Parameters
- $value : int
Return values
Carbon —setMinute()
public
setMinute(int $value) : Carbon
Set current instance minute to the given value.
Parameters
- $value : int
Return values
Carbon —setMinutes()
public
setMinutes(int $value) : Carbon
Set current instance minute to the given value.
Parameters
- $value : int
Return values
Carbon —setMonth()
public
setMonth(int $value) : Carbon
Set current instance month to the given value.
Parameters
- $value : int
Return values
Carbon —setMonths()
public
setMonths(int $value) : Carbon
Set current instance month to the given value.
Parameters
- $value : int
Return values
Carbon —setSecond()
public
setSecond(int $value) : Carbon
Set current instance second to the given value.
Parameters
- $value : int
Return values
Carbon —setSeconds()
public
setSeconds(int $value) : Carbon
Set current instance second to the given value.
Parameters
- $value : int
Return values
Carbon —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
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 —setTimestamp()
Sets the date and time based on an Unix timestamp.
public
setTimestamp(int $unixtimestamp) : static
Parameters
- $unixtimestamp : int
Tags
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
Return values
mixed —setWeekendDays()
public
static setWeekendDays(array<string|int, mixed> $days) : void
Parameters
- $days : array<string|int, mixed>
Tags
Return values
void —setWeekEndsAt()
public
static setWeekEndsAt(int $day) : void
Parameters
- $day : int
Tags
Return values
void —setWeekStartsAt()
public
static setWeekStartsAt(int $day) : void
Parameters
- $day : int
-
week start day
Tags
Return values
void —setYear()
public
setYear(int $value) : Carbon
Set current instance year to the given value.
Parameters
- $value : int
Return values
Carbon —setYears()
public
setYears(int $value) : Carbon
Set current instance year to the given value.
Parameters
- $value : int
Return values
Carbon —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 —subCenturies()
public
subCenturies(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subCenturiesNoOverflow()
public
subCenturiesNoOverflow(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subCenturiesWithNoOverflow()
public
subCenturiesWithNoOverflow(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subCenturiesWithoutOverflow()
public
subCenturiesWithoutOverflow(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subCenturiesWithOverflow()
public
subCenturiesWithOverflow(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subCentury()
public
subCentury() : Carbon
Sub one century to the instance (using date interval).
Return values
Carbon —subCenturyNoOverflow()
public
subCenturyNoOverflow() : Carbon
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subCenturyWithNoOverflow()
public
subCenturyWithNoOverflow() : Carbon
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subCenturyWithoutOverflow()
public
subCenturyWithoutOverflow() : Carbon
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subCenturyWithOverflow()
public
subCenturyWithOverflow() : Carbon
Sub one century to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —subDay()
public
subDay() : Carbon
Sub one day to the instance (using date interval).
Return values
Carbon —subDays()
public
subDays(int $value = 1) : Carbon
Sub days (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subDecade()
public
subDecade() : Carbon
Sub one decade to the instance (using date interval).
Return values
Carbon —subDecadeNoOverflow()
public
subDecadeNoOverflow() : Carbon
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subDecades()
public
subDecades(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subDecadesNoOverflow()
public
subDecadesNoOverflow(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subDecadesWithNoOverflow()
public
subDecadesWithNoOverflow(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subDecadesWithoutOverflow()
public
subDecadesWithoutOverflow(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subDecadesWithOverflow()
public
subDecadesWithOverflow(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subDecadeWithNoOverflow()
public
subDecadeWithNoOverflow() : Carbon
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subDecadeWithoutOverflow()
public
subDecadeWithoutOverflow() : Carbon
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subDecadeWithOverflow()
public
subDecadeWithOverflow() : Carbon
Sub one decade to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —subHour()
public
subHour() : Carbon
Sub one hour to the instance (using date interval).
Return values
Carbon —subHours()
public
subHours(int $value = 1) : Carbon
Sub hours (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMicro()
public
subMicro() : Carbon
Sub one microsecond to the instance (using date interval).
Return values
Carbon —subMicros()
public
subMicros(int $value = 1) : Carbon
Sub microseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMicrosecond()
public
subMicrosecond() : Carbon
Sub one microsecond to the instance (using date interval).
Return values
Carbon —subMicroseconds()
public
subMicroseconds(int $value = 1) : Carbon
Sub microseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMillennia()
public
subMillennia(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMillenniaNoOverflow()
public
subMillenniaNoOverflow(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMillenniaWithNoOverflow()
public
subMillenniaWithNoOverflow(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMillenniaWithoutOverflow()
public
subMillenniaWithoutOverflow(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMillenniaWithOverflow()
public
subMillenniaWithOverflow(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subMillennium()
public
subMillennium() : Carbon
Sub one millennium to the instance (using date interval).
Return values
Carbon —subMillenniumNoOverflow()
public
subMillenniumNoOverflow() : Carbon
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMillenniumWithNoOverflow()
public
subMillenniumWithNoOverflow() : Carbon
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMillenniumWithoutOverflow()
public
subMillenniumWithoutOverflow() : Carbon
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMillenniumWithOverflow()
public
subMillenniumWithOverflow() : Carbon
Sub one millennium to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —subMilli()
public
subMilli() : Carbon
Sub one millisecond to the instance (using date interval).
Return values
Carbon —subMillis()
public
subMillis(int $value = 1) : Carbon
Sub milliseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMillisecond()
public
subMillisecond() : Carbon
Sub one millisecond to the instance (using date interval).
Return values
Carbon —subMilliseconds()
public
subMilliseconds(int $value = 1) : Carbon
Sub milliseconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMinute()
public
subMinute() : Carbon
Sub one minute to the instance (using date interval).
Return values
Carbon —subMinutes()
public
subMinutes(int $value = 1) : Carbon
Sub minutes (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMonth()
public
subMonth() : Carbon
Sub one month to the instance (using date interval).
Return values
Carbon —subMonthNoOverflow()
public
subMonthNoOverflow() : Carbon
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMonths()
public
subMonths(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subMonthsNoOverflow()
public
subMonthsNoOverflow(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMonthsWithNoOverflow()
public
subMonthsWithNoOverflow(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMonthsWithoutOverflow()
public
subMonthsWithoutOverflow(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subMonthsWithOverflow()
public
subMonthsWithOverflow(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subMonthWithNoOverflow()
public
subMonthWithNoOverflow() : Carbon
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMonthWithoutOverflow()
public
subMonthWithoutOverflow() : Carbon
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subMonthWithOverflow()
public
subMonthWithOverflow() : Carbon
Sub one month to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —subQuarter()
public
subQuarter() : Carbon
Sub one quarter to the instance (using date interval).
Return values
Carbon —subQuarterNoOverflow()
public
subQuarterNoOverflow() : Carbon
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subQuarters()
public
subQuarters(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subQuartersNoOverflow()
public
subQuartersNoOverflow(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subQuartersWithNoOverflow()
public
subQuartersWithNoOverflow(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subQuartersWithoutOverflow()
public
subQuartersWithoutOverflow(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subQuartersWithOverflow()
public
subQuartersWithOverflow(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subQuarterWithNoOverflow()
public
subQuarterWithNoOverflow() : Carbon
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subQuarterWithoutOverflow()
public
subQuarterWithoutOverflow() : Carbon
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subQuarterWithOverflow()
public
subQuarterWithOverflow() : Carbon
Sub one quarter to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —subRealCenturies()
public
subRealCenturies(int $value = 1) : Carbon
Sub centuries (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealCentury()
public
subRealCentury() : Carbon
Sub one century to the instance (using timestamp).
Return values
Carbon —subRealDay()
public
subRealDay() : Carbon
Sub one day to the instance (using timestamp).
Return values
Carbon —subRealDays()
public
subRealDays(int $value = 1) : Carbon
Sub days (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealDecade()
public
subRealDecade() : Carbon
Sub one decade to the instance (using timestamp).
Return values
Carbon —subRealDecades()
public
subRealDecades(int $value = 1) : Carbon
Sub decades (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealHour()
public
subRealHour() : Carbon
Sub one hour to the instance (using timestamp).
Return values
Carbon —subRealHours()
public
subRealHours(int $value = 1) : Carbon
Sub hours (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMicro()
public
subRealMicro() : Carbon
Sub one microsecond to the instance (using timestamp).
Return values
Carbon —subRealMicros()
public
subRealMicros(int $value = 1) : Carbon
Sub microseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMicrosecond()
public
subRealMicrosecond() : Carbon
Sub one microsecond to the instance (using timestamp).
Return values
Carbon —subRealMicroseconds()
public
subRealMicroseconds(int $value = 1) : Carbon
Sub microseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMillennia()
public
subRealMillennia(int $value = 1) : Carbon
Sub millennia (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMillennium()
public
subRealMillennium() : Carbon
Sub one millennium to the instance (using timestamp).
Return values
Carbon —subRealMilli()
public
subRealMilli() : Carbon
Sub one millisecond to the instance (using timestamp).
Return values
Carbon —subRealMillis()
public
subRealMillis(int $value = 1) : Carbon
Sub milliseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMillisecond()
public
subRealMillisecond() : Carbon
Sub one millisecond to the instance (using timestamp).
Return values
Carbon —subRealMilliseconds()
public
subRealMilliseconds(int $value = 1) : Carbon
Sub milliseconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMinute()
public
subRealMinute() : Carbon
Sub one minute to the instance (using timestamp).
Return values
Carbon —subRealMinutes()
public
subRealMinutes(int $value = 1) : Carbon
Sub minutes (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealMonth()
public
subRealMonth() : Carbon
Sub one month to the instance (using timestamp).
Return values
Carbon —subRealMonths()
public
subRealMonths(int $value = 1) : Carbon
Sub months (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealQuarter()
public
subRealQuarter() : Carbon
Sub one quarter to the instance (using timestamp).
Return values
Carbon —subRealQuarters()
public
subRealQuarters(int $value = 1) : Carbon
Sub quarters (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealSecond()
public
subRealSecond() : Carbon
Sub one second to the instance (using timestamp).
Return values
Carbon —subRealSeconds()
public
subRealSeconds(int $value = 1) : Carbon
Sub seconds (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealWeek()
public
subRealWeek() : Carbon
Sub one week to the instance (using timestamp).
Return values
Carbon —subRealWeeks()
public
subRealWeeks(int $value = 1) : Carbon
Sub weeks (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subRealYear()
public
subRealYear() : Carbon
Sub one year to the instance (using timestamp).
Return values
Carbon —subRealYears()
public
subRealYears(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using timestamp).
Parameters
- $value = 1 : int
Return values
Carbon —subSecond()
public
subSecond() : Carbon
Sub one second to the instance (using date interval).
Return values
Carbon —subSeconds()
public
subSeconds(int $value = 1) : Carbon
Sub seconds (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —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 —subWeek()
public
subWeek() : Carbon
Sub one week to the instance (using date interval).
Return values
Carbon —subWeekday()
public
subWeekday() : Carbon
Sub one weekday to the instance (using date interval).
Return values
Carbon —subWeekdays()
public
subWeekdays(int $value = 1) : Carbon
Sub weekdays (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subWeeks()
public
subWeeks(int $value = 1) : Carbon
Sub weeks (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subYear()
public
subYear() : Carbon
Sub one year to the instance (using date interval).
Return values
Carbon —subYearNoOverflow()
public
subYearNoOverflow() : Carbon
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subYears()
public
subYears(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using date interval).
Parameters
- $value = 1 : int
Return values
Carbon —subYearsNoOverflow()
public
subYearsNoOverflow(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subYearsWithNoOverflow()
public
subYearsWithNoOverflow(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subYearsWithoutOverflow()
public
subYearsWithoutOverflow(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Parameters
- $value = 1 : int
Return values
Carbon —subYearsWithOverflow()
public
subYearsWithOverflow(int $value = 1) : Carbon
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Parameters
- $value = 1 : int
Return values
Carbon —subYearWithNoOverflow()
public
subYearWithNoOverflow() : Carbon
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subYearWithoutOverflow()
public
subYearWithoutOverflow() : Carbon
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Return values
Carbon —subYearWithOverflow()
public
subYearWithOverflow() : Carbon
Sub one year to the instance (using date interval) with overflow explicitly allowed.
Return values
Carbon —timezone()
public
timezone(DateTimeZone|string $value) : static
Parameters
- $value : DateTimeZone|string
Tags
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 —year()
public
year(int $value) : Carbon
Set current instance year to the given value.
Parameters
- $value : int
Return values
Carbon —years()
public
years(int $value) : Carbon
Set current instance year to the given value.
Parameters
- $value : int
Return values
Carbon —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
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.