interface CarbonInterface implementsDateTimeInterface,JsonSerializable

Common interface for Carbon and CarbonImmutable.

Constants

NO_ZERO_DIFF

Diff wording options(expressed in octal).

JUST_NOW

ONE_DAY_WORDS

TWO_DAY_WORDS

SEQUENTIAL_PARTS_ONLY

ROUND

FLOOR

CEIL

DIFF_ABSOLUTE

Diff syntax options.

DIFF_RELATIVE_AUTO

DIFF_RELATIVE_TO_NOW

DIFF_RELATIVE_TO_OTHER

TRANSLATE_MONTHS

Translate string options.

TRANSLATE_DAYS

TRANSLATE_UNITS

TRANSLATE_MERIDIEM

TRANSLATE_DIFF

TRANSLATE_ALL

SUNDAY

The day constants.

MONDAY

TUESDAY

WEDNESDAY

THURSDAY

FRIDAY

SATURDAY

JANUARY

The month constants.

These aren't used by Carbon itself but exist for convenience sake alone.

FEBRUARY

MARCH

APRIL

MAY

JUNE

JULY

AUGUST

SEPTEMBER

OCTOBER

NOVEMBER

DECEMBER

YEARS_PER_MILLENNIUM

Number of X in Y.

YEARS_PER_CENTURY

YEARS_PER_DECADE

MONTHS_PER_YEAR

MONTHS_PER_QUARTER

QUARTERS_PER_YEAR

WEEKS_PER_YEAR

WEEKS_PER_MONTH

DAYS_PER_YEAR

DAYS_PER_WEEK

HOURS_PER_DAY

MINUTES_PER_HOUR

SECONDS_PER_MINUTE

MILLISECONDS_PER_SECOND

MICROSECONDS_PER_MILLISECOND

MICROSECONDS_PER_SECOND

WEEK_DAY_AUTO

Special settings to get the start of week from current locale culture.

RFC7231_FORMAT

RFC7231 DateTime format.

DEFAULT_TO_STRING_FORMAT

Default format to use for __toString method when type juggling occurs.

MOCK_DATETIME_FORMAT

Format for converting mocked time, includes microseconds.

ISO_FORMAT_REGEXP

Pattern detection for ->isoFormat and ::createFromIsoFormat.

Properties

int $year
int $yearIso
int $month
int $day
int $hour
int $minute
int $second
int $micro
int $microsecond
int|float|string $timestamp seconds since the Unix Epoch
string $englishDayOfWeek the day of week in English
string $shortEnglishDayOfWeek the abbreviated day of week in English
string $englishMonth the month in English
string $shortEnglishMonth the abbreviated month in English
int $milliseconds
int $millisecond
int $milli
int $week 1 through 53
int $isoWeek 1 through 53
int $weekYear year according to week format
int $isoWeekYear year according to ISO week format
int $dayOfYear 1 through 366
int $age does a diffInYears() with default parameters
int $offset the timezone offset in seconds from UTC
int $offsetMinutes the timezone offset in minutes from UTC
int $offsetHours the timezone offset in hours from UTC
CarbonTimeZone $timezone the current timezone
CarbonTimeZone $tz alias of $timezone

Methods

mixed
__call(string$method,array$parameters)

Dynamically handle calls to the class.

static mixed
__callStatic(string$method,array$parameters)

Dynamically handle calls to the class.

__clone()

Update constructedObjectId on cloned.

__construct(DateTimeInterface|string|null$time =null,DateTimeZone|string|null$tz =null)

Create a new Carbon instance.

array
__debugInfo()

Show truthy properties on var_dump().

string|int|bool|DateTimeZone|null
__get(string$name)

Get a part of the Carbon object

bool
__isset(string$name)

Check if an attribute exists on the object

void
__set(string$name,string|int|DateTimeZone$value)

Set a part of the Carbon object

static 
__set_state($dump)

No description

array
__sleep()

Returns the list of properties to dump on serialize() called on.

string
__toString()

Format the instance as a string using the set format

add($unit,$value =1,$overflow =null)

No description

addRealUnit(string$unit,int$value =1)

Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past.

addUnit(string$unit,int$value =1,bool|null$overflow =null)

Add given units to the current instance.

addUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

string
ago(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given to now

average(Carbon|DateTimeInterface|null$date =null)

Modify the current instance to the average of a given instance (default now) and the current instance (second-precision).

avoidMutation()

Clone the current instance if it's mutable.

bool
between(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)

Determines if the instance is between two others.

bool
betweenExcluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Determines if the instance is between two others, bounds excluded.

bool
betweenIncluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Determines if the instance is between two others, bounds included.

string
calendar(Carbon|DateTimeInterface|string|null$referenceTime =null,array$formats =[])

Returns either day of week + time (e.g. "Last Friday at 3:30 PM") if reference time is within 7 days, or a calendar date (e.g. "10/29/2017") otherwise.

static bool
canBeCreatedFromFormat(string$date,string$format)

Checks if the (date)time string is in a given format and valid to create a new instance.

carbonize(Carbon|CarbonPeriod|CarbonInterval|DateInterval|DatePeriod|DateTimeInterface|string|null$date =null)

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

cast(string$className)

Cast the current instance into the given class.

ceil(float|int|string|DateInterval|null$precision =1)

Ceil the current instance second with given precision if specified.

ceilUnit(string$unit,float|int$precision =1)

Ceil the current instance at the given unit with given precision if specified.

ceilWeek(int$weekStartsAt =null)

Ceil the current instance week.

change(string$modifier)

Similar to native modify() method of DateTime but can handle more grammars.

cleanupDumpProperties()

Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.

clone()

No description

closest(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Get the closest date from the instance (second-precision).

copy()

Get a copy of the instance.

static CarbonInterface|false
create(int|null$year =0,int|null$month =1,int|null$day =1,int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a new Carbon instance from a specific date and time.

createFromDate(int|null$year =null,int|null$month =null,int|null$day =null,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a date. The time portion is set to now.

static 
createFromFormat($format,$time,$tz =null)

No description

static CarbonInterface|false
createFromIsoFormat(string$format,string$time,DateTimeZone|string|false|null$tz =null,string|null$locale ='en',TranslatorInterface$translator =null)

Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).

static CarbonInterface|false
createFromLocaleFormat(string$format,string$locale,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific format and a string in a given language.

static CarbonInterface|false
createFromLocaleIsoFormat(string$format,string$locale,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific ISO format and a string in a given language.

createFromTime(int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a time. The date portion is set to today.

createFromTimeString(string$time,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a time string. The date portion is set to today.

createFromTimestamp(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp and set the timezone (use default one if not specified).

createFromTimestampMs(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp in milliseconds.

createFromTimestampMsUTC(float|int|string$timestamp)

Create a Carbon instance from a timestamp in milliseconds.

createFromTimestampUTC(float|int|string$timestamp)

Create a Carbon instance from an timestamp keeping the timezone to UTC.

createMidnightDate(int|null$year =null,int|null$month =null,int|null$day =null,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a date. The time portion is set to midnight.

static CarbonInterface|false
createSafe(int|null$year =null,int|null$month =null,int|null$day =null,int|null$hour =null,int|null$minute =null,int|null$second =null,DateTimeZone|string|null$tz =null)

Create a new safe Carbon instance from a specific date and time.

createStrict(int|null$year =0,int|null$month =1,int|null$day =1,int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a new Carbon instance from a specific date and time using strict validation.

dayOfYear(int|null$value =null)

Get/set the day of year.

diffAsCarbonInterval(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference as a CarbonInterval instance.

int
diffFiltered(CarbonInterval$ci,Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference by the given interval using a filter closure.

string
diffForHumans(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from current instance to an other instance given (or now if null given).

int
diffInDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days rounded down.

int
diffInDaysFiltered(Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days using a filter closure rounded down.

int
diffInHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours rounded down.

int
diffInHoursFiltered(Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours using a filter closure rounded down.

int
diffInMicroseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in microseconds.

int
diffInMilliseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in milliseconds rounded down.

int
diffInMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes rounded down.

int
diffInMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months rounded down.

int
diffInQuarters(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in quarters rounded down.

int
diffInRealHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours rounded down using timestamps.

int
diffInRealMicroseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in microseconds using timestamps.

int
diffInRealMilliseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in milliseconds rounded down using timestamps.

int
diffInRealMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes rounded down using timestamps.

int
diffInRealSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds using timestamps.

int
diffInSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds rounded down.

int
diffInWeekdays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weekdays rounded down.

int
diffInWeekendDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weekend days using a filter rounded down.

int
diffInWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks rounded down.

int
diffInYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in years

static 
disableHumanDiffOption(int$humanDiffOption)deprecated

No description

static 
enableHumanDiffOption(int$humanDiffOption)deprecated

No description

endOf(string$unit,array...$params)

Modify to end of current given unit.

endOfCentury()

Resets the date to end of the century and time to 23:59:59.999999

endOfDay()

Resets the time to 23:59:59.999999 end of day

endOfDecade()

Resets the date to end of the decade and time to 23:59:59.999999

endOfHour()

Modify to end of current hour, minutes and seconds become 59

endOfMillennium()

Resets the date to end of the millennium and time to 23:59:59.999999

endOfMinute()

Modify to end of current minute, seconds become 59

endOfMonth()

Resets the date to end of the month and time to 23:59:59.999999

endOfQuarter()

Resets the date to end of the quarter and time to 23:59:59.999999

endOfSecond()

Modify to end of current second, microseconds become 999999

endOfWeek(int$weekEndsAt =null)

Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999

endOfYear()

Resets the date to end of the year and time to 23:59:59.999999

bool
eq(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is equal to another

bool
equalTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is equal to another

static mixed
executeWithLocale(string$locale,callable$func)

Set the current locale to the given, execute the passed function, reset the locale to previous one, then return the result of the closure (or null if the closure was void).

farthest(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Get the farthest date from the instance (second-precision).

firstOfMonth(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the first day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

firstOfQuarter(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the first day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

firstOfYear(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the first day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

float
floatDiffInDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days as float (microsecond-precision).

float
floatDiffInHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours as float (microsecond-precision).

float
floatDiffInMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes as float (microsecond-precision).

float
floatDiffInMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months as float (microsecond-precision).

float
floatDiffInRealDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days as float (microsecond-precision).

float
floatDiffInRealHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours as float (microsecond-precision) using timestamps.

float
floatDiffInRealMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes as float (microsecond-precision) using timestamps.

float
floatDiffInRealMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months as float (microsecond-precision) using timestamps.

float
floatDiffInRealSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds as float (microsecond-precision) using timestamps.

float
floatDiffInRealWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks as float (microsecond-precision).

float
floatDiffInRealYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in year as float (microsecond-precision) using timestamps.

float
floatDiffInSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds as float (microsecond-precision).

float
floatDiffInWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks as float (microsecond-precision).

float
floatDiffInYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in year as float (microsecond-precision).

floor(float|int|string|DateInterval|null$precision =1)

Round the current instance second with given precision if specified.

floorUnit(string$unit,float|int$precision =1)

Truncate the current instance at the given unit with given precision if specified.

floorWeek(int$weekStartsAt =null)

Truncate the current instance week.

string
formatLocalized(string$format)deprecated

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

string
from(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

No description

string
fromNow(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from current instance to now.

fromSerialized(string$value)

Create an instance from a serialized string.

static void
genericMacro(object|callable$macro,int$priority =0)

Register a custom macro.

string|int|bool|DateTimeZone|null
get(string$name)

Get a part of the Carbon object

string
getAltNumber(string$key)

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

static array
getAvailableLocales()

Returns the list of internally available locales and already loaded custom locales.

static Language[]
getAvailableLocalesInfo()

Returns list of Language object for each available locale. This object allow you to get the ISO name, native name, region and variant of the locale.

array
getCalendarFormats(string|null$locale =null)

Returns list of calendar formats for ISO formatting.

static array
getDays()

Get the days of the week

static string|null
getFallbackLocale()

Get the fallback locale.

static array
getFormatsToIsoReplacements()

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

static int
getHumanDiffOptions()

Return default humanDiff() options (merged flags as integer).

array
getIsoFormats(string|null$locale =null)

Returns list of locale formats for ISO formatting.

static array
getIsoUnits()

Returns list of locale units for ISO formatting.

static 
getLastErrors()

No description

callable|null
getLocalMacro(string$name)

Get the raw callable macro registered globally or locally for a given name.

TranslatorInterface
getLocalTranslator()

Get the translator of the current instance or the default if none set.

static string
getLocale()

Get the current translator locale.

static callable|null
getMacro(string$name)

Get the raw callable macro registered globally for a given name.

static int
getMidDayAt()

get midday/noon hour

string
getOffsetString(string$separator =':')

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

string
getPaddedUnit(string$unit,int$length =2,string$padString ='0',int$padType =0)

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

float
getPreciseTimestamp(int$precision =6)

Returns a timestamp rounded with the given precision (6 by default).

array
getSettings()

Returns current local settings.

getTestNow()

Get the Carbon instance (real or mock) to be returned when a "now" instance is created.

static string
getTimeFormatByPrecision(string$unitPrecision)

Return a format from H:i to H:i:s.u according to given unit precision.

int
getTimestampMs()

Returns the timestamp with millisecond precision.

string
getTranslatedDayName(string|null$context =null,string$keySuffix ='',string|null$defaultValue =null)

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

string
getTranslatedMinDayName(string|null$context =null)

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

string
getTranslatedMonthName(string|null$context =null,string$keySuffix ='',string|null$defaultValue =null)

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

string
getTranslatedShortDayName(string|null$context =null)

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

string
getTranslatedShortMonthName(string|null$context =null)

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

string
getTranslationMessage(string$key,string|null$locale =null,string|null$default =null,TranslatorInterface$translator =null)

Returns raw translation message for a given key.

static string
getTranslationMessageWith(TranslatorInterface$translator,string$key,string|null$locale =null,string|null$default =null)

Returns raw translation message for a given key.

static TranslatorInterface
getTranslator()

Get the default translator instance in use.

static int
getWeekEndsAt()

Get the last day of week

static int
getWeekStartsAt()

Get the first day of week

static array
getWeekendDays()

Get weekend days

bool
greaterThan(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

bool
greaterThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than or equal to another

bool
gt(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

bool
gte(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than or equal to another

static bool
hasFormat(string$date,string$format)

Checks if the (date)time string is in a given format.

static bool
hasFormatWithModifiers(string$date,string$format)

Checks if the (date)time string is in a given format.

bool
hasLocalMacro(string$name)

Checks if macro is registered globally or locally.

bool
hasLocalTranslator()

Return true if the current instance has its own translator.

static bool
hasMacro(string$name)

Checks if macro is registered globally.

static bool
hasRelativeKeywords(string$time)

Determine if a time string will produce a relative date.

static bool
hasTestNow()

Determine if there is a valid test instance set. A valid test instance is anything that is not null.

instance(DateTimeInterface$date)

Create a Carbon instance from a DateTime one.

bool
is(string$tester)

Returns true if the current date matches the given string.

bool
isAfter(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

bool
isBefore(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

bool
isBetween(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)

Determines if the instance is between two others

bool
isBirthday(Carbon|DateTimeInterface|null$date =null)

Check if its the birthday. Compares the date/month values of the two dates.

bool
isCurrentUnit(string$unit)

Determines if the instance is in the current unit given.

bool
isDayOfWeek(int$dayOfWeek)

Checks if this day is a specific day of the week.

bool
isEndOfDay(bool$checkMicroseconds =false)

Check if the instance is end of day.

bool
isEndOfTime()

Returns true if the date was created using CarbonImmutable::endOfTime()

bool
isFuture()

Determines if the instance is in the future, ie. greater (after) than now.

static bool
isImmutable()

Returns true if the current class/instance is immutable.

bool
isLastOfMonth()

Check if today is the last day of the Month

bool
isLeapYear()

Determines if the instance is a leap year.

bool
isLongYear()

Determines if the instance is a long year

bool
isMidday()

Check if the instance is midday.

bool
isMidnight()

Check if the instance is start of day / midnight.

static bool
isModifiableUnit(string$unit)

Returns true if a property can be changed via setter.

static bool
isMutable()

Returns true if the current class/instance is mutable.

bool
isPast()

Determines if the instance is in the past, ie. less (before) than now.

bool
isSameAs(string$format,Carbon|DateTimeInterface|string|null$date =null)

Compares the formatted values of the two dates.

bool
isSameMonth(Carbon|DateTimeInterface|null$date =null,bool$ofSameYear =true)

Checks if the passed in date is in the same month as the instance´s month.

bool
isSameQuarter(Carbon|DateTimeInterface|string|null$date =null,bool$ofSameYear =true)

Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).

bool
isSameUnit(string$unit,Carbon|DateTimeInterface|null$date =null)

Determines if the instance is in the current unit given.

bool
isStartOfDay(bool$checkMicroseconds =false)

Check if the instance is start of day / midnight.

bool
isStartOfTime()

Returns true if the date was created using CarbonImmutable::startOfTime()

static bool
isStrictModeEnabled()

Returns true if the strict mode is globally in use, false else.

bool
isToday()

Determines if the instance is today.

bool
isTomorrow()

Determines if the instance is tomorrow.

bool
isWeekday()

Determines if the instance is a weekday.

bool
isWeekend()

Determines if the instance is a weekend day.

bool
isYesterday()

Determines if the instance is yesterday.

string
isoFormat(string$format,string|null$originalFormat =null)

Format in the current language using ISO replacement patterns.

isoWeek(int|null$week =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get/set the week number using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

isoWeekYear(int|null$year =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Set/get the week number of year using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

isoWeekday(int|null$value =null)

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

int
isoWeeksInYear(int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get the number of weeks of the current week-year using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

jsonSerialize()

No description

lastOfMonth(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the last day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

lastOfQuarter(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the last day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

lastOfYear(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the last day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

bool
lessThan(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

bool
lessThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) or equal to another

$this|string
locale(string|null$locale =null,string...$fallbackLocales)

Get/set the locale for the current instance.

static bool
localeHasDiffOneDayWords(string$locale)

Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow).

static bool
localeHasDiffSyntax(string$locale)

Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after).

static bool
localeHasDiffTwoDayWords(string$locale)

Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow).

static bool
localeHasPeriodSyntax(string$locale)

Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X).

static bool
localeHasShortUnits(string$locale)

Returns true if the given locale is internally supported and has short-units support.

bool
lt(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

bool
lte(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) or equal to another

static void
macro(string$name,object|callable$macro)

Register a custom macro.

static CarbonInterface|null
make(mixed$var)

Make a Carbon instance from given variable if possible.

max(Carbon|DateTimeInterface|mixed$date =null)

Get the maximum instance between a given instance (default now) and the current instance.

maxValue()

Create a Carbon instance for the greatest supported date.

maximum(Carbon|DateTimeInterface|mixed$date =null)

Get the maximum instance between a given instance (default now) and the current instance.

string
meridiem(bool$isLower =false)

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

midDay()

Modify to midday, default to self::$midDayAt

min(Carbon|DateTimeInterface|mixed$date =null)

Get the minimum instance between a given instance (default now) and the current instance.

minValue()

Create a Carbon instance for the lowest supported date.

minimum(Carbon|DateTimeInterface|mixed$date =null)

Get the minimum instance between a given instance (default now) and the current instance.

static void
mixin(object|string$mixin)

Mix another object into the class.

modify($modify)

No description

bool
ne(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is not equal to another

next(string|int|null$modifier =null)

Modify to the next occurrence of a given modifier such as a day of the week. If no modifier is provided, modify to the next occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

nextWeekday()

Go forward to the next weekday.

nextWeekendDay()

Go forward to the next weekend day.

bool
notEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is not equal to another

now(DateTimeZone|string|null$tz =null)

Get a Carbon instance for the current date and time.

nowWithSameTz()

Returns a present instance in the same timezone.

mixed
nthOfMonth(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside the scope of the current month, then return false and no modifications are made.

mixed
nthOfQuarter(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside the scope of the current quarter, then return false and no modifications are made.

mixed
nthOfYear(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current year. If the calculated occurrence is outside the scope of the current year, then return false and no modifications are made.

string
ordinal(string$key,string|null$period =null)

Return a property with its ordinal.

parse(string|DateTimeInterface|null$time =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a string.

parseFromLocale(string$time,string|null$locale =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).

static string
pluralUnit(string$unit)

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

previous(string|int|null$modifier =null)

Modify to the previous occurrence of a given modifier such as a day of the week. If no dayOfWeek is provided, modify to the previous occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

previousWeekday()

Go backward to the previous weekday.

previousWeekendDay()

Go backward to the previous weekend day.

range(DateTimeInterface|Carbon|CarbonImmutable|null$end =null,int|DateInterval|string|null$interval =null,string|null$unit =null)

Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).

rawAdd(DateInterval$interval)

Call native PHP DateTime/DateTimeImmutable add() method.

static CarbonInterface|false
rawCreateFromFormat(string$format,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific format.

string
rawFormat(string$format)

No description

rawParse(string|DateTimeInterface|null$time =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a string.

rawSub(DateInterval$interval)

Call native PHP DateTime/DateTimeImmutable sub() method.

static 
resetMacros()

Remove all macros and generic macros.

static void
resetMonthsOverflow()deprecated

No description

static void
resetToStringFormat()

Reset the format used to the default when type juggling a Carbon instance to a string

static void
resetYearsOverflow()deprecated

No description

round(float|int|string|DateInterval|null$precision =1,string$function ='round')

Round the current instance second with given precision if specified.

roundUnit(string$unit,float|int$precision =1,string$function ='round')

Round the current instance at the given unit with given precision if specified and the given function.

roundWeek(int$weekStartsAt =null)

Round the current instance week.

int
secondsSinceMidnight()

The number of seconds since midnight.

int
secondsUntilEndOfDay()

The number of seconds until 23:59:59.

string
serialize()

Return a serialized string of the instance.

static void
serializeUsing(callable$callback)deprecated

No description

$this
set(string|array$name,string|int|DateTimeZone$value =null)

Set a part of the Carbon object

setDate($year,$month,$day)

No description

setDateFrom(Carbon|DateTimeInterface$date =null)

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

setDateTime(int$year,int$month,int$day,int$hour,int$minute,int$second =0,int$microseconds =0)

Set the date and time all together.

setDateTimeFrom(Carbon|DateTimeInterface$date =null)

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

static 
setFallbackLocale(string$locale)

Set the fallback locale.

static 
setHumanDiffOptions(int$humanDiffOptions)deprecated

No description

setISODate($year,$week,$day =1)

No description

$this
setLocalTranslator(TranslatorInterface$translator)

Set the translator for the current instance.

static bool
setLocale(string$locale)

Set the current translator locale and indicate if the source locale file exists.

static void
setMidDayAt(int$hour)deprecated

No description

static 
setTestNow(Closure|CarbonInterface|string|false|null$testNow =null)

Set a Carbon instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the static now() method, ex. Carbon::now() - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') - When a string containing the desired time is passed to Carbon::parse().

static 
setTestNowAndTimezone($testNow =null,$tz =null)

Set a Carbon instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the static now() method, ex. Carbon::now() - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') - When a string containing the desired time is passed to Carbon::parse().

setTime($hour,$minute,$second =0,$microseconds =0)

No description

setTimeFrom(Carbon|DateTimeInterface$date =null)

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

setTimeFromTimeString(string$time)

Set the time by time string.

setTimestamp($unixTimestamp)

No description

setTimezone($value)

No description

static void
setToStringFormat(string|Closure|null$format)deprecated

No description

static void
setTranslator(TranslatorInterface$translator)

Set the default translator instance to use.

setUnit(string$unit,int$value =null)

Set specified unit to new given value.

setUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

static 
setUtf8(bool$utf8)deprecated

No description

static void
setWeekEndsAt(int|string$day)deprecated

No description

static void
setWeekStartsAt(int|string$day)deprecated

No description

static void
setWeekendDays(array$days)deprecated

No description

settings(array$settings)

Set specific options.

shiftTimezone(DateTimeZone|string$value)

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

static bool
shouldOverflowMonths()

Get the month overflow global behavior (can be overridden in specific instances).

static bool
shouldOverflowYears()

Get the month overflow global behavior (can be overridden in specific instances).

since($other =null,$syntax =null,$short =false,$parts =1,$options =null)

No description

static string
singularUnit(string$unit)

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

startOf(string$unit,array...$params)

Modify to start of current given unit.

startOfCentury()

Resets the date to the first day of the century and the time to 00:00:00

startOfDay()

Resets the time to 00:00:00 start of day

startOfDecade()

Resets the date to the first day of the decade and the time to 00:00:00

startOfHour()

Modify to start of current hour, minutes and seconds become 0

startOfMillennium()

Resets the date to the first day of the millennium and the time to 00:00:00

startOfMinute()

Modify to start of current minute, seconds become 0

startOfMonth()

Resets the date to the first day of the month and the time to 00:00:00

startOfQuarter()

Resets the date to the first day of the quarter and the time to 00:00:00

startOfSecond()

Modify to start of current second, microseconds become 0

startOfWeek(int$weekStartsAt =null)

Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00

startOfYear()

Resets the date to the first day of the year and the time to 00:00:00

sub($unit,$value =1,$overflow =null)

No description

subRealUnit($unit,$value =1)

No description

subUnit(string$unit,int$value =1,bool|null$overflow =null)

Subtract given units to the current instance.

subUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

subtract(string|DateInterval$unit,int$value =1,bool|null$overflow =null)

Subtract given units or interval to the current instance.

string
timespan($other =null,$timezone =null)

Get the difference in a human readable format in the current locale from current instance to an other instance given (or now if null given).

timestamp(float|int|string$unixTimestamp)

Set the instance's timestamp.

timezone(DateTimeZone|string$value)

No description

string
to(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given (or now if null given) to current instance.

array
toArray()

Get default array representation.

string
toAtomString()

Format the instance as ATOM

string
toCookieString()

Format the instance as COOKIE

toDate()

No description

string
toDateString()

Format the instance as date

toDateTime()

Return native DateTime PHP object matching the current instance.

toDateTimeImmutable()

Return native toDateTimeImmutable PHP object matching the current instance.

string
toDateTimeLocalString(string$unitPrecision ='second')

Format the instance as date and time T-separated with no timezone

string
toDateTimeString(string$unitPrecision ='second')

Format the instance as date and time

string
toDayDateTimeString()

Format the instance with day, date and time

string
toFormattedDateString()

Format the instance as a readable date

null|string
toISOString(bool$keepOffset =false)

Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: 1977-04-22T01:00:00-05:00).

toImmutable()

Return a immutable copy of the instance.

string
toIso8601String()

Format the instance as ISO8601

string
toIso8601ZuluString(string$unitPrecision ='second')

Convert the instance to UTC and return as Zulu ISO8601

null|string
toJSON()

Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.

toMutable()

Return a mutable copy of the instance.

string
toNow(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given to now

object
toObject()

Get default object representation.

toPeriod(DateTimeInterface|Carbon|CarbonImmutable|int|null$end =null,int|DateInterval|string|null$interval =null,string|null$unit =null)

Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).

string
toRfc1036String()

Format the instance as RFC1036

string
toRfc1123String()

Format the instance as RFC1123

string
toRfc2822String()

Format the instance as RFC2822

string
toRfc3339String(bool$extended =false)

Format the instance as RFC3339

string
toRfc7231String()

Format the instance as RFC7231

string
toRfc822String()

Format the instance as RFC822

string
toRfc850String()

Format the instance as RFC850

string
toRssString()

Format the instance as RSS

string
toString()

Returns english human readable complete date string.

string
toTimeString(string$unitPrecision ='second')

Format the instance as time

string
toW3cString()

Format the instance as W3C

today(DateTimeZone|string|null$tz =null)

Create a Carbon instance for today.

tomorrow(DateTimeZone|string|null$tz =null)

Create a Carbon instance for tomorrow.

string
translate(string$key,array$parameters =[],string|int|float|null$number =null,TranslatorInterface|null$translator =null,bool$altNumbers =false)

Translate using translation string or callback available.

string
translateNumber(int$number)

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

static string
translateTimeString(string$timeString,string|null$from =null,string|null$to =null,int$mode =self::TRANSLATE_ALL)

Translate a time string from a locale to an other.

string
translateTimeStringTo(string$timeString,string|null$to =null)

Translate a time string from the current locale ($date->locale()) to an other.

static string
translateWith(TranslatorInterface$translator,string$key,array$parameters =[],null$number =null)

Translate using translation string or callback available.

string
translatedFormat(string$format)

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

tz(DateTimeZone|string$value =null)

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

int
unix()

No description

string
until(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

No description

static void
useMonthsOverflow(bool$monthsOverflow =true)deprecated

No description

static 
useStrictMode(bool$strictModeEnabled =true)deprecated

No description

static void
useYearsOverflow(bool$yearsOverflow =true)deprecated

No description

utc()

Set the instance's timezone to UTC.

utcOffset(int|null$minuteOffset =null)

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

float
valueOf()

Returns the milliseconds timestamps used amongst other by Date javascript objects.

week(int|null$week =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get/set the week number using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

weekYear(int|null$year =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Set/get the week number of year using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

weekday(int|null$value =null)

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

int
weeksInYear(int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get the number of weeks of the current week-year using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

static mixed
withTestNow(Closure|CarbonInterface|string|false|null$testNow =null,Closure|null$callback =null)

Temporarily sets a static date to be used within the callback.

yesterday(DateTimeZone|string|null$tz =null)

Create a Carbon instance for yesterday.

bool
isUtc()

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

bool
isLocal()

Check if the current instance has non-UTC timezone.

bool
isValid()

Check if the current instance is a valid date.

bool
isDST()

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

bool
isSunday()

Checks if the instance day is sunday.

bool
isMonday()

Checks if the instance day is monday.

bool
isTuesday()

Checks if the instance day is tuesday.

bool
isWednesday()

Checks if the instance day is wednesday.

bool
isThursday()

Checks if the instance day is thursday.

bool
isFriday()

Checks if the instance day is friday.

bool
isSaturday()

Checks if the instance day is saturday.

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

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

bool
isCurrentYear()

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

bool
isNextYear()

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

bool
isLastYear()

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

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

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

bool
isCurrentWeek()

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

bool
isNextWeek()

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

bool
isLastWeek()

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

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

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

bool
isCurrentDay()

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

bool
isNextDay()

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

bool
isLastDay()

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

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

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

bool
isCurrentHour()

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

bool
isNextHour()

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

bool
isLastHour()

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

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

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

bool
isCurrentMinute()

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

bool
isNextMinute()

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

bool
isLastMinute()

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

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

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

bool
isCurrentSecond()

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

bool
isNextSecond()

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

bool
isLastSecond()

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

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

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

bool
isCurrentMicro()

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

bool
isNextMicro()

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

bool
isLastMicro()

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

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

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

bool
isCurrentMicrosecond()

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

bool
isNextMicrosecond()

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

bool
isLastMicrosecond()

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

bool
isCurrentMonth()

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

bool
isNextMonth()

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

bool
isLastMonth()

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

bool
isCurrentQuarter()

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

bool
isNextQuarter()

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

bool
isLastQuarter()

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

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

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

bool
isCurrentDecade()

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

bool
isNextDecade()

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

bool
isLastDecade()

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

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

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

bool
isCurrentCentury()

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

bool
isNextCentury()

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

bool
isLastCentury()

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

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

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

bool
isCurrentMillennium()

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

bool
isNextMillennium()

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

bool
isLastMillennium()

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

CarbonInterface
years(int $value)

Set current instance year to the given value.

CarbonInterface
year(int $value)

Set current instance year to the given value.

CarbonInterface
setYears(int $value)

Set current instance year to the given value.

CarbonInterface
setYear(int $value)

Set current instance year to the given value.

CarbonInterface
months(int $value)

Set current instance month to the given value.

CarbonInterface
month(int $value)

Set current instance month to the given value.

CarbonInterface
setMonths(int $value)

Set current instance month to the given value.

CarbonInterface
setMonth(int $value)

Set current instance month to the given value.

CarbonInterface
days(int $value)

Set current instance day to the given value.

CarbonInterface
day(int $value)

Set current instance day to the given value.

CarbonInterface
setDays(int $value)

Set current instance day to the given value.

CarbonInterface
setDay(int $value)

Set current instance day to the given value.

CarbonInterface
hours(int $value)

Set current instance hour to the given value.

CarbonInterface
hour(int $value)

Set current instance hour to the given value.

CarbonInterface
setHours(int $value)

Set current instance hour to the given value.

CarbonInterface
setHour(int $value)

Set current instance hour to the given value.

CarbonInterface
minutes(int $value)

Set current instance minute to the given value.

CarbonInterface
minute(int $value)

Set current instance minute to the given value.

CarbonInterface
setMinutes(int $value)

Set current instance minute to the given value.

CarbonInterface
setMinute(int $value)

Set current instance minute to the given value.

CarbonInterface
seconds(int $value)

Set current instance second to the given value.

CarbonInterface
second(int $value)

Set current instance second to the given value.

CarbonInterface
setSeconds(int $value)

Set current instance second to the given value.

CarbonInterface
setSecond(int $value)

Set current instance second to the given value.

CarbonInterface
millis(int $value)

Set current instance millisecond to the given value.

CarbonInterface
milli(int $value)

Set current instance millisecond to the given value.

CarbonInterface
setMillis(int $value)

Set current instance millisecond to the given value.

CarbonInterface
setMilli(int $value)

Set current instance millisecond to the given value.

CarbonInterface
milliseconds(int $value)

Set current instance millisecond to the given value.

CarbonInterface
millisecond(int $value)

Set current instance millisecond to the given value.

CarbonInterface
setMilliseconds(int $value)

Set current instance millisecond to the given value.

CarbonInterface
setMillisecond(int $value)

Set current instance millisecond to the given value.

CarbonInterface
micros(int $value)

Set current instance microsecond to the given value.

CarbonInterface
micro(int $value)

Set current instance microsecond to the given value.

CarbonInterface
setMicros(int $value)

Set current instance microsecond to the given value.

CarbonInterface
setMicro(int $value)

Set current instance microsecond to the given value.

CarbonInterface
microseconds(int $value)

Set current instance microsecond to the given value.

CarbonInterface
microsecond(int $value)

Set current instance microsecond to the given value.

CarbonInterface
setMicroseconds(int $value)

Set current instance microsecond to the given value.

CarbonInterface
setMicrosecond(int $value)

Set current instance microsecond to the given value.

CarbonInterface
addYears(int $value =1)

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

CarbonInterface
addYear()

Add one year to the instance (using date interval).

CarbonInterface
subYears(int $value =1)

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

CarbonInterface
subYear()

Sub one year to the instance (using date interval).

CarbonInterface
addYearsWithOverflow(int $value =1)

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

CarbonInterface
addYearWithOverflow()

Add one year to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subYearsWithOverflow(int $value =1)

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

CarbonInterface
subYearWithOverflow()

Sub one year to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addYearsWithoutOverflow(int $value =1)

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

CarbonInterface
addYearWithoutOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subYearsWithoutOverflow(int $value =1)

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

CarbonInterface
subYearWithoutOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addYearsWithNoOverflow(int $value =1)

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

CarbonInterface
addYearWithNoOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subYearsWithNoOverflow(int $value =1)

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

CarbonInterface
subYearWithNoOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addYearsNoOverflow(int $value =1)

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

CarbonInterface
addYearNoOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subYearsNoOverflow(int $value =1)

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

CarbonInterface
subYearNoOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addMonths(int $value =1)

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

CarbonInterface
addMonth()

Add one month to the instance (using date interval).

CarbonInterface
subMonths(int $value =1)

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

CarbonInterface
subMonth()

Sub one month to the instance (using date interval).

CarbonInterface
addMonthsWithOverflow(int $value =1)

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

CarbonInterface
addMonthWithOverflow()

Add one month to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subMonthsWithOverflow(int $value =1)

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

CarbonInterface
subMonthWithOverflow()

Sub one month to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addMonthsWithoutOverflow(int $value =1)

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

CarbonInterface
addMonthWithoutOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMonthsWithoutOverflow(int $value =1)

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

CarbonInterface
subMonthWithoutOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addMonthsWithNoOverflow(int $value =1)

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

CarbonInterface
addMonthWithNoOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMonthsWithNoOverflow(int $value =1)

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

CarbonInterface
subMonthWithNoOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addMonthsNoOverflow(int $value =1)

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

CarbonInterface
addMonthNoOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMonthsNoOverflow(int $value =1)

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

CarbonInterface
subMonthNoOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addDays(int $value =1)

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

CarbonInterface
addDay()

Add one day to the instance (using date interval).

CarbonInterface
subDays(int $value =1)

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

CarbonInterface
subDay()

Sub one day to the instance (using date interval).

CarbonInterface
addHours(int $value =1)

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

CarbonInterface
addHour()

Add one hour to the instance (using date interval).

CarbonInterface
subHours(int $value =1)

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

CarbonInterface
subHour()

Sub one hour to the instance (using date interval).

CarbonInterface
addMinutes(int $value =1)

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

CarbonInterface
addMinute()

Add one minute to the instance (using date interval).

CarbonInterface
subMinutes(int $value =1)

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

CarbonInterface
subMinute()

Sub one minute to the instance (using date interval).

CarbonInterface
addSeconds(int $value =1)

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

CarbonInterface
addSecond()

Add one second to the instance (using date interval).

CarbonInterface
subSeconds(int $value =1)

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

CarbonInterface
subSecond()

Sub one second to the instance (using date interval).

CarbonInterface
addMillis(int $value =1)

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

CarbonInterface
addMilli()

Add one millisecond to the instance (using date interval).

CarbonInterface
subMillis(int $value =1)

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

CarbonInterface
subMilli()

Sub one millisecond to the instance (using date interval).

CarbonInterface
addMilliseconds(int $value =1)

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

CarbonInterface
addMillisecond()

Add one millisecond to the instance (using date interval).

CarbonInterface
subMilliseconds(int $value =1)

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

CarbonInterface
subMillisecond()

Sub one millisecond to the instance (using date interval).

CarbonInterface
addMicros(int $value =1)

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

CarbonInterface
addMicro()

Add one microsecond to the instance (using date interval).

CarbonInterface
subMicros(int $value =1)

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

CarbonInterface
subMicro()

Sub one microsecond to the instance (using date interval).

CarbonInterface
addMicroseconds(int $value =1)

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

CarbonInterface
addMicrosecond()

Add one microsecond to the instance (using date interval).

CarbonInterface
subMicroseconds(int $value =1)

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

CarbonInterface
subMicrosecond()

Sub one microsecond to the instance (using date interval).

CarbonInterface
addMillennia(int $value =1)

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

CarbonInterface
addMillennium()

Add one millennium to the instance (using date interval).

CarbonInterface
subMillennia(int $value =1)

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

CarbonInterface
subMillennium()

Sub one millennium to the instance (using date interval).

CarbonInterface
addMillenniaWithOverflow(int $value =1)

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

CarbonInterface
addMillenniumWithOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subMillenniaWithOverflow(int $value =1)

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

CarbonInterface
subMillenniumWithOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addMillenniaWithoutOverflow(int $value =1)

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

CarbonInterface
addMillenniumWithoutOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMillenniaWithoutOverflow(int $value =1)

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

CarbonInterface
subMillenniumWithoutOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addMillenniaWithNoOverflow(int $value =1)

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

CarbonInterface
addMillenniumWithNoOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMillenniaWithNoOverflow(int $value =1)

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

CarbonInterface
subMillenniumWithNoOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addMillenniaNoOverflow(int $value =1)

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

CarbonInterface
addMillenniumNoOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subMillenniaNoOverflow(int $value =1)

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

CarbonInterface
subMillenniumNoOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addCenturies(int $value =1)

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

CarbonInterface
addCentury()

Add one century to the instance (using date interval).

CarbonInterface
subCenturies(int $value =1)

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

CarbonInterface
subCentury()

Sub one century to the instance (using date interval).

CarbonInterface
addCenturiesWithOverflow(int $value =1)

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

CarbonInterface
addCenturyWithOverflow()

Add one century to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subCenturiesWithOverflow(int $value =1)

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

CarbonInterface
subCenturyWithOverflow()

Sub one century to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addCenturiesWithoutOverflow(int $value =1)

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

CarbonInterface
addCenturyWithoutOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subCenturiesWithoutOverflow(int $value =1)

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

CarbonInterface
subCenturyWithoutOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addCenturiesWithNoOverflow(int $value =1)

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

CarbonInterface
addCenturyWithNoOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subCenturiesWithNoOverflow(int $value =1)

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

CarbonInterface
subCenturyWithNoOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addCenturiesNoOverflow(int $value =1)

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

CarbonInterface
addCenturyNoOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subCenturiesNoOverflow(int $value =1)

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

CarbonInterface
subCenturyNoOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addDecades(int $value =1)

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

CarbonInterface
addDecade()

Add one decade to the instance (using date interval).

CarbonInterface
subDecades(int $value =1)

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

CarbonInterface
subDecade()

Sub one decade to the instance (using date interval).

CarbonInterface
addDecadesWithOverflow(int $value =1)

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

CarbonInterface
addDecadeWithOverflow()

Add one decade to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subDecadesWithOverflow(int $value =1)

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

CarbonInterface
subDecadeWithOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addDecadesWithoutOverflow(int $value =1)

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

CarbonInterface
addDecadeWithoutOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subDecadesWithoutOverflow(int $value =1)

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

CarbonInterface
subDecadeWithoutOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addDecadesWithNoOverflow(int $value =1)

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

CarbonInterface
addDecadeWithNoOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subDecadesWithNoOverflow(int $value =1)

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

CarbonInterface
subDecadeWithNoOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addDecadesNoOverflow(int $value =1)

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

CarbonInterface
addDecadeNoOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subDecadesNoOverflow(int $value =1)

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

CarbonInterface
subDecadeNoOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addQuarters(int $value =1)

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

CarbonInterface
addQuarter()

Add one quarter to the instance (using date interval).

CarbonInterface
subQuarters(int $value =1)

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

CarbonInterface
subQuarter()

Sub one quarter to the instance (using date interval).

CarbonInterface
addQuartersWithOverflow(int $value =1)

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

CarbonInterface
addQuarterWithOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
subQuartersWithOverflow(int $value =1)

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

CarbonInterface
subQuarterWithOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly allowed.

CarbonInterface
addQuartersWithoutOverflow(int $value =1)

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

CarbonInterface
addQuarterWithoutOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subQuartersWithoutOverflow(int $value =1)

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

CarbonInterface
subQuarterWithoutOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addQuartersWithNoOverflow(int $value =1)

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

CarbonInterface
addQuarterWithNoOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subQuartersWithNoOverflow(int $value =1)

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

CarbonInterface
subQuarterWithNoOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addQuartersNoOverflow(int $value =1)

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

CarbonInterface
addQuarterNoOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
subQuartersNoOverflow(int $value =1)

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

CarbonInterface
subQuarterNoOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

CarbonInterface
addWeeks(int $value =1)

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

CarbonInterface
addWeek()

Add one week to the instance (using date interval).

CarbonInterface
subWeeks(int $value =1)

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

CarbonInterface
subWeek()

Sub one week to the instance (using date interval).

CarbonInterface
addWeekdays(int $value =1)

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

CarbonInterface
addWeekday()

Add one weekday to the instance (using date interval).

CarbonInterface
subWeekdays(int $value =1)

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

CarbonInterface
subWeekday()

Sub one weekday to the instance (using date interval).

CarbonInterface
addRealMicros(int $value =1)

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

CarbonInterface
addRealMicro()

Add one microsecond to the instance (using timestamp).

CarbonInterface
subRealMicros(int $value =1)

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

CarbonInterface
subRealMicro()

Sub one microsecond to the instance (using timestamp).

CarbonPeriod
microsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.

CarbonInterface
addRealMicroseconds(int $value =1)

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

CarbonInterface
addRealMicrosecond()

Add one microsecond to the instance (using timestamp).

CarbonInterface
subRealMicroseconds(int $value =1)

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

CarbonInterface
subRealMicrosecond()

Sub one microsecond to the instance (using timestamp).

CarbonPeriod
microsecondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.

CarbonInterface
addRealMillis(int $value =1)

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

CarbonInterface
addRealMilli()

Add one millisecond to the instance (using timestamp).

CarbonInterface
subRealMillis(int $value =1)

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

CarbonInterface
subRealMilli()

Sub one millisecond to the instance (using timestamp).

CarbonPeriod
millisUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.

CarbonInterface
addRealMilliseconds(int $value =1)

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

CarbonInterface
addRealMillisecond()

Add one millisecond to the instance (using timestamp).

CarbonInterface
subRealMilliseconds(int $value =1)

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

CarbonInterface
subRealMillisecond()

Sub one millisecond to the instance (using timestamp).

CarbonPeriod
millisecondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.

CarbonInterface
addRealSeconds(int $value =1)

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

CarbonInterface
addRealSecond()

Add one second to the instance (using timestamp).

CarbonInterface
subRealSeconds(int $value =1)

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

CarbonInterface
subRealSecond()

Sub one second to the instance (using timestamp).

CarbonPeriod
secondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given.

CarbonInterface
addRealMinutes(int $value =1)

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

CarbonInterface
addRealMinute()

Add one minute to the instance (using timestamp).

CarbonInterface
subRealMinutes(int $value =1)

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

CarbonInterface
subRealMinute()

Sub one minute to the instance (using timestamp).

CarbonPeriod
minutesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given.

CarbonInterface
addRealHours(int $value =1)

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

CarbonInterface
addRealHour()

Add one hour to the instance (using timestamp).

CarbonInterface
subRealHours(int $value =1)

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

CarbonInterface
subRealHour()

Sub one hour to the instance (using timestamp).

CarbonPeriod
hoursUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given.

CarbonInterface
addRealDays(int $value =1)

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

CarbonInterface
addRealDay()

Add one day to the instance (using timestamp).

CarbonInterface
subRealDays(int $value =1)

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

CarbonInterface
subRealDay()

Sub one day to the instance (using timestamp).

CarbonPeriod
daysUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given.

CarbonInterface
addRealWeeks(int $value =1)

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

CarbonInterface
addRealWeek()

Add one week to the instance (using timestamp).

CarbonInterface
subRealWeeks(int $value =1)

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

CarbonInterface
subRealWeek()

Sub one week to the instance (using timestamp).

CarbonPeriod
weeksUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given.

CarbonInterface
addRealMonths(int $value =1)

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

CarbonInterface
addRealMonth()

Add one month to the instance (using timestamp).

CarbonInterface
subRealMonths(int $value =1)

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

CarbonInterface
subRealMonth()

Sub one month to the instance (using timestamp).

CarbonPeriod
monthsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given.

CarbonInterface
addRealQuarters(int $value =1)

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

CarbonInterface
addRealQuarter()

Add one quarter to the instance (using timestamp).

CarbonInterface
subRealQuarters(int $value =1)

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

CarbonInterface
subRealQuarter()

Sub one quarter to the instance (using timestamp).

CarbonPeriod
quartersUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given.

CarbonInterface
addRealYears(int $value =1)

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

CarbonInterface
addRealYear()

Add one year to the instance (using timestamp).

CarbonInterface
subRealYears(int $value =1)

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

CarbonInterface
subRealYear()

Sub one year to the instance (using timestamp).

CarbonPeriod
yearsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given.

CarbonInterface
addRealDecades(int $value =1)

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

CarbonInterface
addRealDecade()

Add one decade to the instance (using timestamp).

CarbonInterface
subRealDecades(int $value =1)

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

CarbonInterface
subRealDecade()

Sub one decade to the instance (using timestamp).

CarbonPeriod
decadesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given.

CarbonInterface
addRealCenturies(int $value =1)

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

CarbonInterface
addRealCentury()

Add one century to the instance (using timestamp).

CarbonInterface
subRealCenturies(int $value =1)

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

CarbonInterface
subRealCentury()

Sub one century to the instance (using timestamp).

CarbonPeriod
centuriesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given.

CarbonInterface
addRealMillennia(int $value =1)

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

CarbonInterface
addRealMillennium()

Add one millennium to the instance (using timestamp).

CarbonInterface
subRealMillennia(int $value =1)

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

CarbonInterface
subRealMillennium()

Sub one millennium to the instance (using timestamp).

CarbonPeriod
millenniaUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given.

CarbonInterface
roundYear(float $precision =1,string $function ="round")

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

CarbonInterface
roundYears(float $precision =1,string $function ="round")

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

CarbonInterface
floorYear(float $precision =1)

Truncate the current instance year with given precision.

CarbonInterface
floorYears(float $precision =1)

Truncate the current instance year with given precision.

CarbonInterface
ceilYear(float $precision =1)

Ceil the current instance year with given precision.

CarbonInterface
ceilYears(float $precision =1)

Ceil the current instance year with given precision.

CarbonInterface
roundMonth(float $precision =1,string $function ="round")

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

CarbonInterface
roundMonths(float $precision =1,string $function ="round")

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

CarbonInterface
floorMonth(float $precision =1)

Truncate the current instance month with given precision.

CarbonInterface
floorMonths(float $precision =1)

Truncate the current instance month with given precision.

CarbonInterface
ceilMonth(float $precision =1)

Ceil the current instance month with given precision.

CarbonInterface
ceilMonths(float $precision =1)

Ceil the current instance month with given precision.

CarbonInterface
roundDay(float $precision =1,string $function ="round")

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

CarbonInterface
roundDays(float $precision =1,string $function ="round")

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

CarbonInterface
floorDay(float $precision =1)

Truncate the current instance day with given precision.

CarbonInterface
floorDays(float $precision =1)

Truncate the current instance day with given precision.

CarbonInterface
ceilDay(float $precision =1)

Ceil the current instance day with given precision.

CarbonInterface
ceilDays(float $precision =1)

Ceil the current instance day with given precision.

CarbonInterface
roundHour(float $precision =1,string $function ="round")

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

CarbonInterface
roundHours(float $precision =1,string $function ="round")

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

CarbonInterface
floorHour(float $precision =1)

Truncate the current instance hour with given precision.

CarbonInterface
floorHours(float $precision =1)

Truncate the current instance hour with given precision.

CarbonInterface
ceilHour(float $precision =1)

Ceil the current instance hour with given precision.

CarbonInterface
ceilHours(float $precision =1)

Ceil the current instance hour with given precision.

CarbonInterface
roundMinute(float $precision =1,string $function ="round")

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

CarbonInterface
roundMinutes(float $precision =1,string $function ="round")

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

CarbonInterface
floorMinute(float $precision =1)

Truncate the current instance minute with given precision.

CarbonInterface
floorMinutes(float $precision =1)

Truncate the current instance minute with given precision.

CarbonInterface
ceilMinute(float $precision =1)

Ceil the current instance minute with given precision.

CarbonInterface
ceilMinutes(float $precision =1)

Ceil the current instance minute with given precision.

CarbonInterface
roundSecond(float $precision =1,string $function ="round")

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

CarbonInterface
roundSeconds(float $precision =1,string $function ="round")

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

CarbonInterface
floorSecond(float $precision =1)

Truncate the current instance second with given precision.

CarbonInterface
floorSeconds(float $precision =1)

Truncate the current instance second with given precision.

CarbonInterface
ceilSecond(float $precision =1)

Ceil the current instance second with given precision.

CarbonInterface
ceilSeconds(float $precision =1)

Ceil the current instance second with given precision.

CarbonInterface
roundMillennium(float $precision =1,string $function ="round")

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

CarbonInterface
roundMillennia(float $precision =1,string $function ="round")

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

CarbonInterface
floorMillennium(float $precision =1)

Truncate the current instance millennium with given precision.

CarbonInterface
floorMillennia(float $precision =1)

Truncate the current instance millennium with given precision.

CarbonInterface
ceilMillennium(float $precision =1)

Ceil the current instance millennium with given precision.

CarbonInterface
ceilMillennia(float $precision =1)

Ceil the current instance millennium with given precision.

CarbonInterface
roundCentury(float $precision =1,string $function ="round")

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

CarbonInterface
roundCenturies(float $precision =1,string $function ="round")

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

CarbonInterface
floorCentury(float $precision =1)

Truncate the current instance century with given precision.

CarbonInterface
floorCenturies(float $precision =1)

Truncate the current instance century with given precision.

CarbonInterface
ceilCentury(float $precision =1)

Ceil the current instance century with given precision.

CarbonInterface
ceilCenturies(float $precision =1)

Ceil the current instance century with given precision.

CarbonInterface
roundDecade(float $precision =1,string $function ="round")

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

CarbonInterface
roundDecades(float $precision =1,string $function ="round")

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

CarbonInterface
floorDecade(float $precision =1)

Truncate the current instance decade with given precision.

CarbonInterface
floorDecades(float $precision =1)

Truncate the current instance decade with given precision.

CarbonInterface
ceilDecade(float $precision =1)

Ceil the current instance decade with given precision.

CarbonInterface
ceilDecades(float $precision =1)

Ceil the current instance decade with given precision.

CarbonInterface
roundQuarter(float $precision =1,string $function ="round")

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

CarbonInterface
roundQuarters(float $precision =1,string $function ="round")

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

CarbonInterface
floorQuarter(float $precision =1)

Truncate the current instance quarter with given precision.

CarbonInterface
floorQuarters(float $precision =1)

Truncate the current instance quarter with given precision.

CarbonInterface
ceilQuarter(float $precision =1)

Ceil the current instance quarter with given precision.

CarbonInterface
ceilQuarters(float $precision =1)

Ceil the current instance quarter with given precision.

CarbonInterface
roundMillisecond(float $precision =1,string $function ="round")

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

CarbonInterface
roundMilliseconds(float $precision =1,string $function ="round")

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

CarbonInterface
floorMillisecond(float $precision =1)

Truncate the current instance millisecond with given precision.

CarbonInterface
floorMilliseconds(float $precision =1)

Truncate the current instance millisecond with given precision.

CarbonInterface
ceilMillisecond(float $precision =1)

Ceil the current instance millisecond with given precision.

CarbonInterface
ceilMilliseconds(float $precision =1)

Ceil the current instance millisecond with given precision.

CarbonInterface
roundMicrosecond(float $precision =1,string $function ="round")

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

CarbonInterface
roundMicroseconds(float $precision =1,string $function ="round")

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

CarbonInterface
floorMicrosecond(float $precision =1)

Truncate the current instance microsecond with given precision.

CarbonInterface
floorMicroseconds(float $precision =1)

Truncate the current instance microsecond with given precision.

CarbonInterface
ceilMicrosecond(float $precision =1)

Ceil the current instance microsecond with given precision.

CarbonInterface
ceilMicroseconds(float $precision =1)

Ceil the current instance microsecond with given precision.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Details

at line646
mixed __call(string$method,array$parameters)

Dynamically handle calls to the class.

Parameters

string $method magic method name called
array $parameters parameters list

Return Value

mixed

Exceptions

Throwable

at line658
staticmixed __callStatic(string$method,array$parameters)

Dynamically handle calls to the class.

Parameters

string $method magic method name called
array $parameters parameters list

Return Value

mixed

Exceptions

BadMethodCallException

at line663
__clone()

Update constructedObjectId on cloned.

at line676
__construct(DateTimeInterface|string|null$time =null,DateTimeZone|string|null$tz =null)

Create a new Carbon instance.

Please see the testing aids section (specifically static::setTestNow()) for more on the possibility of this constructor returning a test instance.

Parameters

DateTimeInterface|string|null $time
DateTimeZone|string|null $tz

Exceptions

InvalidFormatException

at line683
array __debugInfo()

Show truthy properties on var_dump().

Return Value

array

at line694
string|int|bool|DateTimeZone|null __get(string$name)

Get a part of the Carbon object

Parameters

string $name

Return Value

string|int|bool|DateTimeZone|null

Exceptions

UnknownGetterException

at line703
bool __isset(string$name)

Check if an attribute exists on the object

Parameters

string $name

Return Value

bool

at line715
void __set(string$name,string|int|DateTimeZone$value)

Set a part of the Carbon object

Parameters

string $name
string|int|DateTimeZone $value

Return Value

void

Exceptions

ReflectionException

at line725
static __set_state($dump)

Parameters

$dump

at line732
array __sleep()

Returns the list of properties to dump on serialize() called on.

Return Value

array

at line744
string __toString()

Format the instance as a string using the set format

Return Value

string

at line760
add($unit,$value =1,$overflow =null)

Parameters

$unit
$value
$overflow

at line771
CarbonInterface addRealUnit(string$unit,int$value =1)

Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past.

Parameters

string $unit
int $value

Return Value

CarbonInterface

at line782
CarbonInterface addUnit(string$unit,int$value =1,bool|null$overflow =null)

Add given units to the current instance.

Parameters

string $unit
int $value
bool|null $overflow

Return Value

CarbonInterface

at line793
CarbonInterface addUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

Parameters

string $valueUnit unit name to modify
int $value amount to add to the input unit
string $overflowUnit unit name to not overflow

Return Value

CarbonInterface

at line823
string ago(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given to now

Parameters

int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single part)
int $options human diff options

Return Value

string

at line833
CarbonInterface average(Carbon|DateTimeInterface|null$date =null)

Modify the current instance to the average of a given instance (default now) and the current instance (second-precision).

Parameters

Carbon|DateTimeInterface|null $date

Return Value

CarbonInterface

at line843
CarbonInterface avoidMutation()

Clone the current instance if it's mutable.

This method is convenient to ensure you don't mutate the initial object but avoid to make a useless copy of it if it's already immutable.

Return Value

CarbonInterface

at line866
bool between(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)

Determines if the instance is between two others.

The third argument allow you to specify if bounds are included or not (true by default) but for when you including/excluding bounds may produce different results in your application, we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead.

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2
bool $equal Indicates if an equal to comparison should be done

Return Value

bool

at line883
bool betweenExcluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Determines if the instance is between two others, bounds excluded.

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2

Return Value

bool

at line900
bool betweenIncluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Determines if the instance is between two others, bounds included.

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2

Return Value

bool

at line913
string calendar(Carbon|DateTimeInterface|string|null$referenceTime =null,array$formats =[])

Returns either day of week + time (e.g. "Last Friday at 3:30 PM") if reference time is within 7 days, or a calendar date (e.g. "10/29/2017") otherwise.

Language, date and time formats will change according to the current locale.

Parameters

Carbon|DateTimeInterface|string|null $referenceTime
array $formats

Return Value

string

at line930
staticbool canBeCreatedFromFormat(string$date,string$format)

Checks if the (date)time string is in a given format and valid to create a new instance.

Parameters

string $date
string $format

Return Value

bool

at line940
CarbonInterface carbonize(Carbon|CarbonPeriod|CarbonInterval|DateInterval|DatePeriod|DateTimeInterface|string|null$date =null)

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

at line949
DateTimeInterface cast(string$className)

Cast the current instance into the given class.

Parameters

string $className The $className::instance() method will be called to cast the current object.

Return Value

DateTimeInterface

at line958
CarbonInterface ceil(float|int|string|DateInterval|null$precision =1)

Ceil the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision

Return Value

CarbonInterface

at line968
CarbonInterface ceilUnit(string$unit,float|int$precision =1)

Ceil the current instance at the given unit with given precision if specified.

Parameters

string $unit
float|int $precision

Return Value

CarbonInterface

at line977
CarbonInterface ceilWeek(int$weekStartsAt =null)

Ceil the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line993
CarbonInterface change(string$modifier)

Similar to native modify() method of DateTime but can handle more grammars.

Parameters

string $modifier

Return Value

CarbonInterface

at line1002
cleanupDumpProperties()

Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.

foreach ($date as $_) {} serializer($date) var_export($date) get_object_vars($date)

at line1011
CarbonInterface clone()

Return Value

CarbonInterface

at line1021
CarbonInterface closest(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Get the closest date from the instance (second-precision).

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2

Return Value

CarbonInterface

at line1028
CarbonInterface copy()

Get a copy of the instance.

Return Value

CarbonInterface

at line1054
staticCarbonInterface|false create(int|null$year =0,int|null$month =1,int|null$day =1,int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a new Carbon instance from a specific date and time.

If any of $year, $month or $day are set to null their now() values will be used.

If $hour is null it will be set to its now() value and the default values for $minute and $second will be their now() values.

If $hour is not null then the default values for $minute and $second will be 0.

Parameters

int|null $year
int|null $month
int|null $day
int|null $hour
int|null $minute
int|null $second
DateTimeZone|string|null $tz

Return Value

CarbonInterface|false

Exceptions

InvalidFormatException

at line1068
staticCarbonInterface createFromDate(int|null$year =null,int|null$month =null,int|null$day =null,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a date. The time portion is set to now.

Parameters

int|null $year
int|null $month
int|null $day
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line1082
static createFromFormat($format,$time,$tz =null)

Parameters

$format
$time
$tz

at line1097
staticCarbonInterface|false createFromIsoFormat(string$format,string$time,DateTimeZone|string|false|null$tz =null,string|null$locale ='en',TranslatorInterface$translator =null)

Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).

Parameters

string $format Datetime format
string $time
DateTimeZone|string|false|null $tz optional timezone
string|null $locale locale to be used for LTS, LT, LL, LLL, etc. macro-formats (en by fault, unneeded if no such macro-format in use)
TranslatorInterface $translator optional custom translator to use for macro-formats

Return Value

CarbonInterface|false

Exceptions

InvalidFormatException

at line1111
staticCarbonInterface|false createFromLocaleFormat(string$format,string$locale,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific format and a string in a given language.

Parameters

string $format Datetime format
string $locale
string $time
DateTimeZone|string|false|null $tz

Return Value

CarbonInterface|false

Exceptions

InvalidFormatException

at line1125
staticCarbonInterface|false createFromLocaleIsoFormat(string$format,string$locale,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific ISO format and a string in a given language.

Parameters

string $format Datetime ISO format
string $locale
string $time
DateTimeZone|string|false|null $tz

Return Value

CarbonInterface|false

Exceptions

InvalidFormatException

at line1139
staticCarbonInterface createFromTime(int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a time. The date portion is set to today.

Parameters

int|null $hour
int|null $minute
int|null $second
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line1151
staticCarbonInterface createFromTimeString(string$time,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a time string. The date portion is set to today.

Parameters

string $time
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line1163
staticCarbonInterface createFromTimestamp(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp and set the timezone (use default one if not specified).

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp
DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line1175
staticCarbonInterface createFromTimestampMs(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp in milliseconds.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp
DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line1186
staticCarbonInterface createFromTimestampMsUTC(float|int|string$timestamp)

Create a Carbon instance from a timestamp in milliseconds.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp

Return Value

CarbonInterface

at line1197
staticCarbonInterface createFromTimestampUTC(float|int|string$timestamp)

Create a Carbon instance from an timestamp keeping the timezone to UTC.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp

Return Value

CarbonInterface

at line1211
staticCarbonInterface createMidnightDate(int|null$year =null,int|null$month =null,int|null$day =null,DateTimeZone|string|null$tz =null)

Create a Carbon instance from just a date. The time portion is set to midnight.

Parameters

int|null $year
int|null $month
int|null $day
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line1240
staticCarbonInterface|false createSafe(int|null$year =null,int|null$month =null,int|null$day =null,int|null$hour =null,int|null$minute =null,int|null$second =null,DateTimeZone|string|null$tz =null)

Create a new safe Carbon instance from a specific date and time.

If any of $year, $month or $day are set to null their now() values will be used.

If $hour is null it will be set to its now() value and the default values for $minute and $second will be their now() values.

If $hour is not null then the default values for $minute and $second will be 0.

If one of the set values is not valid, an InvalidDateException will be thrown.

Parameters

int|null $year
int|null $month
int|null $day
int|null $hour
int|null $minute
int|null $second
DateTimeZone|string|null $tz

Return Value

CarbonInterface|false

Exceptions

InvalidDateException

at line1259
staticCarbonInterface createStrict(int|null$year =0,int|null$month =1,int|null$day =1,int|null$hour =0,int|null$minute =0,int|null$second =0,DateTimeZone|string|null$tz =null)

Create a new Carbon instance from a specific date and time using strict validation.

Parameters

int|null $year
int|null $month
int|null $day
int|null $hour
int|null $minute
int|null $second
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

See also

create()

at line1268
CarbonInterface|int dayOfYear(int|null$value =null)

Get/set the day of year.

Parameters

int|null $value new value for day of year if using as setter.

Return Value

CarbonInterface|int

at line1280
CarbonInterval diffAsCarbonInterval(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference as a CarbonInterval instance.

Return relative interval (negative if $absolute flag is not set to true and the given date is before current one).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

CarbonInterval

at line1292
int diffFiltered(CarbonInterval$ci,Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference by the given interval using a filter closure.

Parameters

CarbonInterval $ci An interval to traverse by
Closure $callback
CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1341
string diffForHumans(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from current instance to an other instance given (or now if null given).

Parameters

Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; if null passed, now will be used as comparison reference; if any other type, it will be converted to date and used as reference.
int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'skip' entry, list of units to skip (array of strings or a single string, it can be the unit name (singular or plural) or its shortcut (y, m, w, d, h, min, s, ms, µs). - 'aUnit' entry, prefer "an hour" over "1 hour" if true - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue - 'other' entry (see above) - 'minimumUnit' entry determines the smallest unit of time to display can be long or ` short form of the units, e.g. 'hour' or 'h' (default value: s) if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options

Return Value

string

at line1351
int diffInDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1362
int diffInDaysFiltered(Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days using a filter closure rounded down.

Parameters

Closure $callback
CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1372
int diffInHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1383
int diffInHoursFiltered(Closure$callback,CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours using a filter closure rounded down.

Parameters

Closure $callback
CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1393
int diffInMicroseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in microseconds.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1403
int diffInMilliseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in milliseconds rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1413
int diffInMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1423
int diffInMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1433
int diffInQuarters(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in quarters rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1443
int diffInRealHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours rounded down using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1453
int diffInRealMicroseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in microseconds using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1463
int diffInRealMilliseconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in milliseconds rounded down using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1473
int diffInRealMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes rounded down using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1483
int diffInRealSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1493
int diffInSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1503
int diffInWeekdays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weekdays rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1513
int diffInWeekendDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weekend days using a filter rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1523
int diffInWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks rounded down.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1533
int diffInYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in years

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

int

at line1542
static disableHumanDiffOption(int$humanDiffOption)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method.

Parameters

int $humanDiffOption

See also

settings

at line1551
static enableHumanDiffOption(int$humanDiffOption)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method.

Parameters

int $humanDiffOption

See also

settings

at line1568
CarbonInterface endOf(string$unit,array...$params)

Modify to end of current given unit.

Parameters

string $unit
array ...$params mixed> $params

Return Value

CarbonInterface

at line1580
CarbonInterface endOfCentury()

Resets the date to end of the century and time to 23:59:59.999999

Return Value

CarbonInterface

at line1592
CarbonInterface endOfDay()

Resets the time to 23:59:59.999999 end of day

Return Value

CarbonInterface

at line1604
CarbonInterface endOfDecade()

Resets the date to end of the decade and time to 23:59:59.999999

Return Value

CarbonInterface

at line1616
CarbonInterface endOfHour()

Modify to end of current hour, minutes and seconds become 59

Return Value

CarbonInterface

at line1628
CarbonInterface endOfMillennium()

Resets the date to end of the millennium and time to 23:59:59.999999

Return Value

CarbonInterface

at line1640
CarbonInterface endOfMinute()

Modify to end of current minute, seconds become 59

Return Value

CarbonInterface

at line1652
CarbonInterface endOfMonth()

Resets the date to end of the month and time to 23:59:59.999999

Return Value

CarbonInterface

at line1664
CarbonInterface endOfQuarter()

Resets the date to end of the quarter and time to 23:59:59.999999

Return Value

CarbonInterface

at line1678
CarbonInterface endOfSecond()

Modify to end of current second, microseconds become 999999

Return Value

CarbonInterface

at line1694
CarbonInterface endOfWeek(int$weekEndsAt =null)

Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999

Parameters

int $weekEndsAt optional start allow you to specify the day of week to use to end the week

Return Value

CarbonInterface

at line1706
CarbonInterface endOfYear()

Resets the date to end of the year and time to 23:59:59.999999

Return Value

CarbonInterface

at line1724
bool eq(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

equalTo()

at line1740
bool equalTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line1751
staticmixed executeWithLocale(string$locale,callable$func)

Set the current locale to the given, execute the passed function, reset the locale to previous one, then return the result of the closure (or null if the closure was void).

Parameters

string $locale locale ex. en
callable $func

Return Value

mixed

at line1761
CarbonInterface farthest(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)

Get the farthest date from the instance (second-precision).

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2

Return Value

CarbonInterface

at line1773
CarbonInterface firstOfMonth(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the first day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek

Return Value

CarbonInterface

at line1785
CarbonInterface firstOfQuarter(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the first day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek day of the week default null

Return Value

CarbonInterface

at line1797
CarbonInterface firstOfYear(int|null$dayOfWeek =null)

Modify to the first occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the first day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek day of the week default null

Return Value

CarbonInterface

at line1807
float floatDiffInDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1817
float floatDiffInHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1827
float floatDiffInMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1837
float floatDiffInMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1847
float floatDiffInRealDays(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in days as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1857
float floatDiffInRealHours(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in hours as float (microsecond-precision) using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1867
float floatDiffInRealMinutes(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in minutes as float (microsecond-precision) using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1877
float floatDiffInRealMonths(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in months as float (microsecond-precision) using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1887
float floatDiffInRealSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds as float (microsecond-precision) using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1897
float floatDiffInRealWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1907
float floatDiffInRealYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in year as float (microsecond-precision) using timestamps.

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1917
float floatDiffInSeconds(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in seconds as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1927
float floatDiffInWeeks(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in weeks as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1937
float floatDiffInYears(CarbonInterface|DateTimeInterface|string|null$date =null,bool$absolute =true)

Get the difference in year as float (microsecond-precision).

Parameters

CarbonInterface|DateTimeInterface|string|null $date
bool $absolute Get the absolute of the difference

Return Value

float

at line1946
CarbonInterface floor(float|int|string|DateInterval|null$precision =1)

Round the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision

Return Value

CarbonInterface

at line1956
CarbonInterface floorUnit(string$unit,float|int$precision =1)

Truncate the current instance at the given unit with given precision if specified.

Parameters

string $unit
float|int $precision

Return Value

CarbonInterface

at line1965
CarbonInterface floorWeek(int$weekStartsAt =null)

Truncate the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line1979
string formatLocalized(string$format)deprecated

deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. Use ->isoFormat() instead. Deprecated since 2.55.0

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

Parameters

string $format

Return Value

string

at line2015
string from(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Parameters

Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; if null passed, now will be used as comparison reference; if any other type, it will be converted to date and used as reference.
int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue - 'other' entry (see above) if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options

Return Value

string

at line2045
string fromNow(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from current instance to now.

Parameters

int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options

Return Value

string

at line2056
staticCarbonInterface fromSerialized(string$value)

Create an instance from a serialized string.

Parameters

string $value

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line2066
staticvoid genericMacro(object|callable$macro,int$priority =0)

Register a custom macro.

Parameters

object|callable $macro
int $priority marco with higher priority is tried first

Return Value

void

at line2077
string|int|bool|DateTimeZone|null get(string$name)

Get a part of the Carbon object

Parameters

string $name

Return Value

string|int|bool|DateTimeZone|null

Exceptions

UnknownGetterException

at line2086
string getAltNumber(string$key)

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

Parameters

string $key date property

Return Value

string

at line2094
staticarray getAvailableLocales()

Returns the list of internally available locales and already loaded custom locales.

(It will ignore custom translator dynamic loading.)

Return Value

array

at line2102
staticLanguage[] getAvailableLocalesInfo()

Returns list of Language object for each available locale. This object allow you to get the ISO name, native name, region and variant of the locale.

Return Value

Language[]

at line2111
array getCalendarFormats(string|null$locale =null)

Returns list of calendar formats for ISO formatting.

Parameters

string|null $locale current locale used if null

Return Value

array

at line2118
staticarray getDays()

Get the days of the week

Return Value

array

at line2127
staticstring|null getFallbackLocale()

Get the fallback locale.

at line2134
staticarray getFormatsToIsoReplacements()

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

Return Value

array

at line2141
staticint getHumanDiffOptions()

Return default humanDiff() options (merged flags as integer).

Return Value

int

at line2150
array getIsoFormats(string|null$locale =null)

Returns list of locale formats for ISO formatting.

Parameters

string|null $locale current locale used if null

Return Value

array

at line2157
staticarray getIsoUnits()

Returns list of locale units for ISO formatting.

Return Value

array

at line2165
static getLastErrors()

at line2174
callable|null getLocalMacro(string$name)

Get the raw callable macro registered globally or locally for a given name.

Parameters

string $name

Return Value

callable|null

at line2181
TranslatorInterface getLocalTranslator()

Get the translator of the current instance or the default if none set.

Return Value

TranslatorInterface

at line2188
staticstring getLocale()

Get the current translator locale.

Return Value

string

at line2197
staticcallable|null getMacro(string$name)

Get the raw callable macro registered globally for a given name.

Parameters

string $name

Return Value

callable|null

at line2204
staticint getMidDayAt()

get midday/noon hour

Return Value

int

at line2216
string getOffsetString(string$separator =':')

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

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

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

Return Value

string

at line2228
string getPaddedUnit(string$unit,int$length =2,string$padString ='0',int$padType =0)

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

Parameters

string $unit Carbon unit name
int $length Length of the output (2 by default)
string $padString String to use for padding ("0" by default)
int $padType Side(s) to pad (STR_PAD_LEFT by default)

Return Value

string

at line2248
float getPreciseTimestamp(int$precision =6)

Returns a timestamp rounded with the given precision (6 by default).

Parameters

int $precision

Return Value

float

at line2255
array getSettings()

Returns current local settings.

Return Value

array

at line2263
staticClosure|CarbonInterface getTestNow()

Get the Carbon instance (real or mock) to be returned when a "now" instance is created.

Return Value

Closure|CarbonInterface the current instance used for testing

at line2272
staticstring getTimeFormatByPrecision(string$unitPrecision)

Return a format from H:i to H:i:s.u according to given unit precision.

Parameters

string $unitPrecision "minute", "second", "millisecond" or "microsecond"

Return Value

string

at line2279
int getTimestampMs()

Returns the timestamp with millisecond precision.

Return Value

int

at line2290
string getTranslatedDayName(string|null$context =null,string$keySuffix ='',string|null$defaultValue =null)

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

Parameters

string|null $context whole format string
string $keySuffix "", "_short" or "_min"
string|null $defaultValue default value if translation missing

Return Value

string

at line2299
string getTranslatedMinDayName(string|null$context =null)

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

Parameters

string|null $context whole format string

Return Value

string

at line2310
string getTranslatedMonthName(string|null$context =null,string$keySuffix ='',string|null$defaultValue =null)

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

Parameters

string|null $context whole format string
string $keySuffix "" or "_short"
string|null $defaultValue default value if translation missing

Return Value

string

at line2319
string getTranslatedShortDayName(string|null$context =null)

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

Parameters

string|null $context whole format string

Return Value

string

at line2328
string getTranslatedShortMonthName(string|null$context =null)

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

Parameters

string|null $context whole format string

Return Value

string

at line2340
string getTranslationMessage(string$key,string|null$locale =null,string|null$default =null,TranslatorInterface$translator =null)

Returns raw translation message for a given key.

Parameters

string $key key to find
string|null $locale current locale used if null
string|null $default default value if translation returns the key
TranslatorInterface $translator an optional translator to use

Return Value

string

at line2352
staticstring getTranslationMessageWith(TranslatorInterface$translator,string$key,string|null$locale =null,string|null$default =null)

Returns raw translation message for a given key.

Parameters

TranslatorInterface $translator the translator to use
string $key key to find
string|null $locale current locale used if null
string|null $default default value if translation returns the key

Return Value

string

at line2359
staticTranslatorInterface getTranslator()

Get the default translator instance in use.

Return Value

TranslatorInterface

at line2366
staticint getWeekEndsAt()

Get the last day of week

Return Value

int

at line2373
staticint getWeekStartsAt()

Get the first day of week

Return Value

int

at line2380
staticarray getWeekendDays()

Get weekend days

Return Value

array

at line2396
bool greaterThan(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line2412
bool greaterThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than or equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line2430
bool gt(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

greaterThan()

at line2448
bool gte(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than or equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

greaterThanOrEqualTo()

at line2464
staticbool hasFormat(string$date,string$format)

Checks if the (date)time string is in a given format.

Parameters

string $date
string $format

Return Value

bool

at line2480
staticbool hasFormatWithModifiers(string$date,string$format)

Checks if the (date)time string is in a given format.

Parameters

string $date
string $format

Return Value

bool

at line2489
bool hasLocalMacro(string$name)

Checks if macro is registered globally or locally.

Parameters

string $name

Return Value

bool

at line2496
bool hasLocalTranslator()

Return true if the current instance has its own translator.

Return Value

bool

at line2505
staticbool hasMacro(string$name)

Checks if macro is registered globally.

Parameters

string $name

Return Value

bool

at line2514
staticbool hasRelativeKeywords(string$time)

Determine if a time string will produce a relative date.

Parameters

string $time

Return Value

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

at line2522
staticbool hasTestNow()

Determine if there is a valid test instance set. A valid test instance is anything that is not null.

Return Value

bool true if there is a test instance, otherwise false

at line2531
staticCarbonInterface instance(DateTimeInterface$date)

Create a Carbon instance from a DateTime one.

Parameters

DateTimeInterface $date

Return Value

CarbonInterface

at line2557
bool is(string$tester)

Returns true if the current date matches the given string.

Parameters

string $tester day name, month name, hour, date, etc. as string

Return Value

bool

at line2575
bool isAfter(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is greater (after) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

greaterThan()

at line2593
bool isBefore(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

lessThan()

at line2612
bool isBetween(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)

Determines if the instance is between two others

Parameters

Carbon|DateTimeInterface|mixed $date1
Carbon|DateTimeInterface|mixed $date2
bool $equal Indicates if an equal to comparison should be done

Return Value

bool

at line2629
bool isBirthday(Carbon|DateTimeInterface|null$date =null)

Check if its the birthday. Compares the date/month values of the two dates.

Parameters

Carbon|DateTimeInterface|null $date The instance to compare with or null to use current day.

Return Value

bool

at line2646
bool isCurrentUnit(string$unit)

Determines if the instance is in the current unit given.

Parameters

string $unit The unit to test.

Return Value

bool

Exceptions

BadMethodCallException

at line2663
bool isDayOfWeek(int$dayOfWeek)

Checks if this day is a specific day of the week.

Parameters

int $dayOfWeek

Return Value

bool

at line2683
bool isEndOfDay(bool$checkMicroseconds =false)

Check if the instance is end of day.

Parameters

bool $checkMicroseconds check time at microseconds precision

Return Value

bool

at line2690
bool isEndOfTime()

Returns true if the date was created using CarbonImmutable::endOfTime()

Return Value

bool

at line2703
bool isFuture()

Determines if the instance is in the future, ie. greater (after) than now.

Return Value

bool

at line2710
staticbool isImmutable()

Returns true if the current class/instance is immutable.

Return Value

bool

at line2726
bool isLastOfMonth()

Check if today is the last day of the Month

Return Value

bool

at line2739
bool isLeapYear()

Determines if the instance is a leap year.

Return Value

bool

at line2754
bool isLongYear()

Determines if the instance is a long year

at line2769
bool isMidday()

Check if the instance is midday.

Return Value

bool

at line2783
bool isMidnight()

Check if the instance is start of day / midnight.

Return Value

bool

at line2792
staticbool isModifiableUnit(string$unit)

Returns true if a property can be changed via setter.

Parameters

string $unit

Return Value

bool

at line2799
staticbool isMutable()

Returns true if the current class/instance is mutable.

Return Value

bool

at line2812
bool isPast()

Determines if the instance is in the past, ie. less (before) than now.

Return Value

bool

at line2828
bool isSameAs(string$format,Carbon|DateTimeInterface|string|null$date =null)

Compares the formatted values of the two dates.

Parameters

string $format date formats to compare.
Carbon|DateTimeInterface|string|null $date instance to compare with or null to use current day.

Return Value

bool

at line2846
bool isSameMonth(Carbon|DateTimeInterface|null$date =null,bool$ofSameYear =true)

Checks if the passed in date is in the same month as the instance´s month.

Parameters

Carbon|DateTimeInterface|null $date The instance to compare with or null to use the current date.
bool $ofSameYear Check if it is the same month in the same year.

Return Value

bool

at line2864
bool isSameQuarter(Carbon|DateTimeInterface|string|null$date =null,bool$ofSameYear =true)

Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).

Parameters

Carbon|DateTimeInterface|string|null $date The instance to compare with or null to use current day.
bool $ofSameYear Check if it is the same month in the same year.

Return Value

bool

at line2882
bool isSameUnit(string$unit,Carbon|DateTimeInterface|null$date =null)

Determines if the instance is in the current unit given.

Parameters

string $unit singular unit string
Carbon|DateTimeInterface|null $date instance to compare with or null to use current day.

Return Value

bool

Exceptions

BadComparisonUnitException

at line2900
bool isStartOfDay(bool$checkMicroseconds =false)

Check if the instance is start of day / midnight.

Parameters

bool $checkMicroseconds check time at microseconds precision

Return Value

bool

at line2907
bool isStartOfTime()

Returns true if the date was created using CarbonImmutable::startOfTime()

Return Value

bool

at line2915
staticbool isStrictModeEnabled()

Returns true if the strict mode is globally in use, false else.

(It can be overridden in specific instances.)

Return Value

bool

at line2928
bool isToday()

Determines if the instance is today.

Return Value

bool

at line2941
bool isTomorrow()

Determines if the instance is tomorrow.

Return Value

bool

at line2954
bool isWeekday()

Determines if the instance is a weekday.

Return Value

bool

at line2967
bool isWeekend()

Determines if the instance is a weekend day.

Return Value

bool

at line2980
bool isYesterday()

Determines if the instance is yesterday.

Return Value

bool

at line2990
string isoFormat(string$format,string|null$originalFormat =null)

Format in the current language using ISO replacement patterns.

Parameters

string $format
string|null $originalFormat provide context if a chunk has been passed alone

Return Value

string

at line3003
int|CarbonInterface isoWeek(int|null$week =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get/set the week number using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

Parameters

int|null $week
int|null $dayOfWeek
int|null $dayOfYear

Return Value

int|CarbonInterface

at line3016
int|CarbonInterface isoWeekYear(int|null$year =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Set/get the week number of year using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

Parameters

int|null $year if null, act as a getter, if not null, set the year and return current instance.
int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
int|null $dayOfYear first day of year included in the week #1

Return Value

int|CarbonInterface

at line3025
CarbonInterface|int isoWeekday(int|null$value =null)

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

Parameters

int|null $value new value for weekday if using as setter.

Return Value

CarbonInterface|int

at line3037
int isoWeeksInYear(int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get the number of weeks of the current week-year using given first day of week and first day of year included in the first week. Or use ISO format if no settings given.

Parameters

int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
int|null $dayOfYear first day of year included in the week #1

Return Value

int

at line3045
jsonSerialize()

at line3057
CarbonInterface lastOfMonth(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the last day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek

Return Value

CarbonInterface

at line3069
CarbonInterface lastOfQuarter(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the last day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek day of the week default null

Return Value

CarbonInterface

at line3081
CarbonInterface lastOfYear(int|null$dayOfWeek =null)

Modify to the last occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the last day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek day of the week default null

Return Value

CarbonInterface

at line3097
bool lessThan(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line3113
bool lessThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) or equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line3123
$this|string locale(string|null$locale =null,string...$fallbackLocales)

Get/set the locale for the current instance.

Parameters

string|null $locale
string ...$fallbackLocales

Return Value

$this|string

at line3133
staticbool localeHasDiffOneDayWords(string$locale)

Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow).

Support is considered enabled if the 3 words are translated in the given locale.

Parameters

string $locale locale ex. en

Return Value

bool

at line3143
staticbool localeHasDiffSyntax(string$locale)

Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after).

Support is considered enabled if the 4 sentences are translated in the given locale.

Parameters

string $locale locale ex. en

Return Value

bool

at line3153
staticbool localeHasDiffTwoDayWords(string$locale)

Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow).

Support is considered enabled if the 2 words are translated in the given locale.

Parameters

string $locale locale ex. en

Return Value

bool

at line3163
staticbool localeHasPeriodSyntax(string$locale)

Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X).

Support is considered enabled if the 4 sentences are translated in the given locale.

Parameters

string $locale locale ex. en

Return Value

bool

at line3173
staticbool localeHasShortUnits(string$locale)

Returns true if the given locale is internally supported and has short-units support.

Support is considered enabled if either year, day or hour has a short variant translated.

Parameters

string $locale locale ex. en

Return Value

bool

at line3191
bool lt(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) than another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

lessThan()

at line3209
bool lte(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is less (before) or equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

lessThanOrEqualTo()

at line3231
staticvoid macro(string$name,object|callable$macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

at line3245
staticCarbonInterface|null make(mixed$var)

Make a Carbon instance from given variable if possible.

Always return a new instance. Parse only strings and only these likely to be dates (skip intervals and recurrences). Throw an exception for invalid format, but otherwise return null.

Parameters

mixed $var

Return Value

CarbonInterface|null

Exceptions

InvalidFormatException

at line3254
CarbonInterface max(Carbon|DateTimeInterface|mixed$date =null)

Get the maximum instance between a given instance (default now) and the current instance.

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

CarbonInterface

at line3261
staticCarbonInterface maxValue()

Create a Carbon instance for the greatest supported date.

Return Value

CarbonInterface

at line3272
CarbonInterface maximum(Carbon|DateTimeInterface|mixed$date =null)

Get the maximum instance between a given instance (default now) and the current instance.

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

CarbonInterface

See also

max()

at line3281
string meridiem(bool$isLower =false)

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

Parameters

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

Return Value

string

at line3288
CarbonInterface midDay()

Modify to midday, default to self::$midDayAt

Return Value

CarbonInterface

at line3297
CarbonInterface min(Carbon|DateTimeInterface|mixed$date =null)

Get the minimum instance between a given instance (default now) and the current instance.

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

CarbonInterface

at line3304
staticCarbonInterface minValue()

Create a Carbon instance for the lowest supported date.

Return Value

CarbonInterface

at line3315
CarbonInterface minimum(Carbon|DateTimeInterface|mixed$date =null)

Get the minimum instance between a given instance (default now) and the current instance.

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

CarbonInterface

See also

min()

at line3348
staticvoid mixin(object|string$mixin)

Mix another object into the class.

Parameters

object|string $mixin

Return Value

void

Exceptions

ReflectionException

at line3358
modify($modify)

Parameters

$modify

at line3376
bool ne(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is not equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

See also

notEqualTo()

at line3388
CarbonInterface next(string|int|null$modifier =null)

Modify to the next occurrence of a given modifier such as a day of the week. If no modifier is provided, modify to the next occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

string|int|null $modifier

Return Value

CarbonInterface

at line3395
CarbonInterface nextWeekday()

Go forward to the next weekday.

Return Value

CarbonInterface

at line3402
CarbonInterface nextWeekendDay()

Go forward to the next weekend day.

Return Value

CarbonInterface

at line3418
bool notEqualTo(Carbon|DateTimeInterface|mixed$date)

Determines if the instance is not equal to another

Parameters

Carbon|DateTimeInterface|mixed $date

Return Value

bool

at line3427
staticCarbonInterface now(DateTimeZone|string|null$tz =null)

Get a Carbon instance for the current date and time.

Parameters

DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line3434
CarbonInterface nowWithSameTz()

Returns a present instance in the same timezone.

Return Value

CarbonInterface

at line3447
mixed nthOfMonth(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside the scope of the current month, then return false and no modifications are made.

Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int $nth
int $dayOfWeek

Return Value

mixed

at line3460
mixed nthOfQuarter(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside the scope of the current quarter, then return false and no modifications are made.

Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int $nth
int $dayOfWeek

Return Value

mixed

at line3473
mixed nthOfYear(int$nth,int$dayOfWeek)

Modify to the given occurrence of a given day of the week in the current year. If the calculated occurrence is outside the scope of the current year, then return false and no modifications are made.

Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int $nth
int $dayOfWeek

Return Value

mixed

at line3483
string ordinal(string$key,string|null$period =null)

Return a property with its ordinal.

Parameters

string $key
string|null $period

Return Value

string

at line3499
staticCarbonInterface parse(string|DateTimeInterface|null$time =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a string.

This is an alias for the constructor that allows better fluent syntax as it allows you to do Carbon::parse('Monday next week')->fn() rather than (new Carbon('Monday next week'))->fn().

Parameters

string|DateTimeInterface|null $time
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line3513
staticCarbonInterface parseFromLocale(string$time,string|null$locale =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).

Parameters

string $time date/time string in the given language (may also contain English).
string|null $locale if locale is null or not specified, current global locale will be used instead.
DateTimeZone|string|null $tz optional timezone for the new instance.

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line3522
staticstring pluralUnit(string$unit)

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

Parameters

string $unit

Return Value

string

at line3534
CarbonInterface previous(string|int|null$modifier =null)

Modify to the previous occurrence of a given modifier such as a day of the week. If no dayOfWeek is provided, modify to the previous occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

string|int|null $modifier

Return Value

CarbonInterface

at line3541
CarbonInterface previousWeekday()

Go backward to the previous weekday.

Return Value

CarbonInterface

at line3548
CarbonInterface previousWeekendDay()

Go backward to the previous weekend day.

Return Value

CarbonInterface

at line3559
CarbonPeriod range(DateTimeInterface|Carbon|CarbonImmutable|null$end =null,int|DateInterval|string|null$interval =null,string|null$unit =null)

Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).

Parameters

DateTimeInterface|Carbon|CarbonImmutable|null $end period end date
int|DateInterval|string|null $interval period default interval or number of the given $unit
string|null $unit if specified, $interval must be an integer

Return Value

CarbonPeriod

at line3568
CarbonInterface rawAdd(DateInterval$interval)

Call native PHP DateTime/DateTimeImmutable add() method.

Parameters

DateInterval $interval

Return Value

CarbonInterface

at line3581
staticCarbonInterface|false rawCreateFromFormat(string$format,string$time,DateTimeZone|string|false|null$tz =null)

Create a Carbon instance from a specific format.

Parameters

string $format Datetime format
string $time
DateTimeZone|string|false|null $tz

Return Value

CarbonInterface|false

Exceptions

InvalidFormatException

at line3590
string rawFormat(string$format)

Parameters

string $format

Return Value

string

See also

https://php.net/manual/en/datetime.format.php

at line3606
staticCarbonInterface rawParse(string|DateTimeInterface|null$time =null,DateTimeZone|string|null$tz =null)

Create a carbon instance from a string.

This is an alias for the constructor that allows better fluent syntax as it allows you to do Carbon::parse('Monday next week')->fn() rather than (new Carbon('Monday next week'))->fn().

Parameters

string|DateTimeInterface|null $time
DateTimeZone|string|null $tz

Return Value

CarbonInterface

Exceptions

InvalidFormatException

at line3615
CarbonInterface rawSub(DateInterval$interval)

Call native PHP DateTime/DateTimeImmutable sub() method.

Parameters

DateInterval $interval

Return Value

CarbonInterface

at line3620
static resetMacros()

Remove all macros and generic macros.

at line3633
staticvoid resetMonthsOverflow()deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method. Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants are available for quarters, years, decade, centuries, millennia (singular and plural forms).

Return Value

void

See also

settings Reset the month overflow behavior.

at line3640
staticvoid resetToStringFormat()

Reset the format used to the default when type juggling a Carbon instance to a string

Return Value

void

at line3653
staticvoid resetYearsOverflow()deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method. Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants are available for quarters, years, decade, centuries, millennia (singular and plural forms).

Return Value

void

See also

settings Reset the month overflow behavior.

at line3663
CarbonInterface round(float|int|string|DateInterval|null$precision =1,string$function ='round')

Round the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision
string $function

Return Value

CarbonInterface

at line3674
CarbonInterface roundUnit(string$unit,float|int$precision =1,string$function ='round')

Round the current instance at the given unit with given precision if specified and the given function.

Parameters

string $unit
float|int $precision
string $function

Return Value

CarbonInterface

at line3683
CarbonInterface roundWeek(int$weekStartsAt =null)

Round the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line3690
int secondsSinceMidnight()

The number of seconds since midnight.

Return Value

int

at line3697
int secondsUntilEndOfDay()

The number of seconds until 23:59:59.

Return Value

int

at line3704
string serialize()

Return a serialized string of the instance.

Return Value

string

at line3716
staticvoid serializeUsing(callable$callback)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather transform Carbon object before the serialization. JSON serialize all Carbon instances using the given callback.

Parameters

callable $callback

Return Value

void

at line3728
$this set(string|array$name,string|int|DateTimeZone$value =null)

Set a part of the Carbon object

Parameters

string|array $name
string|int|DateTimeZone $value

Return Value

$this

Exceptions

UnknownSetterException

at line3742
setDate($year,$month,$day)

Parameters

$year
$month
$day

at line3751
CarbonInterface setDateFrom(Carbon|DateTimeInterface$date =null)

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

Parameters

Carbon|DateTimeInterface $date now if null

Return Value

CarbonInterface

at line3766
CarbonInterface setDateTime(int$year,int$month,int$day,int$hour,int$minute,int$second =0,int$microseconds =0)

Set the date and time all together.

Parameters

int $year
int $month
int $day
int $hour
int $minute
int $second
int $microseconds

Return Value

CarbonInterface

at line3775
CarbonInterface setDateTimeFrom(Carbon|DateTimeInterface$date =null)

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

Parameters

Carbon|DateTimeInterface $date

Return Value

CarbonInterface

at line3784
static setFallbackLocale(string$locale)

Set the fallback locale.

at line3793
static setHumanDiffOptions(int$humanDiffOptions)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method.

Parameters

int $humanDiffOptions

See also

settings

at line3807
setISODate($year,$week,$day =1)

Parameters

$year
$week
$day

at line3816
$this setLocalTranslator(TranslatorInterface$translator)

Set the translator for the current instance.

Parameters

TranslatorInterface $translator

Return Value

$this

at line3826
staticbool setLocale(string$locale)

Set the current translator locale and indicate if the source locale file exists.

Pass 'auto' as locale to use closest language from the current LC_TIME locale.

Parameters

string $locale locale ex. en

Return Value

bool

at line3842
staticvoid setMidDayAt(int$hour)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather consider mid-day is always 12pm, then if you need to test if it's an other hour, test it explicitly: $date->format('G') == 13 or to set explicitly to a given hour: $date->setTime(13, 0, 0, 0) Set midday/noon hour

Parameters

int $hour midday hour

Return Value

void

at line3866
static setTestNow(Closure|CarbonInterface|string|false|null$testNow =null)

Set a Carbon instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the static now() method, ex. Carbon::now() - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') - When a string containing the desired time is passed to Carbon::parse().

Note the timezone parameter was left out of the examples above and has no affect as the mock value will be returned regardless of its value.

Only the moment is mocked with setTestNow(), the timezone will still be the one passed as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()).

To clear the test instance call this method using the default parameter of null.

/!\ Use this method for unit tests only.

Parameters

Closure|CarbonInterface|string|false|null $testNow real or mock Carbon instance

at line3887
static setTestNowAndTimezone($testNow =null,$tz =null)

Set a Carbon instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the static now() method, ex. Carbon::now() - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') - When a string containing the desired time is passed to Carbon::parse().

It will also align default timezone (e.g. call date_default_timezone_set()) with the second argument or if null, with the timezone of the given date object.

To clear the test instance call this method using the default parameter of null.

/!\ Use this method for unit tests only.

Parameters

$testNow
$tz

at line3902
setTime($hour,$minute,$second =0,$microseconds =0)

Parameters

$hour
$minute
$second
$microseconds

at line3911
CarbonInterface setTimeFrom(Carbon|DateTimeInterface$date =null)

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

Parameters

Carbon|DateTimeInterface $date now if null

Return Value

CarbonInterface

at line3920
CarbonInterface setTimeFromTimeString(string$time)

Set the time by time string.

Parameters

string $time

Return Value

CarbonInterface

at line3932
setTimestamp($unixTimestamp)

Parameters

$unixTimestamp

at line3942
setTimezone($value)

Parameters

$value

at line3956
staticvoid setToStringFormat(string|Closure|null$format)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and use other method or custom format passed to format() method if you need to dump an other string format. Set the default format used when type juggling a Carbon instance to a string

Parameters

string|Closure|null $format

Return Value

void

at line3965
staticvoid setTranslator(TranslatorInterface$translator)

Set the default translator instance to use.

Parameters

TranslatorInterface $translator

Return Value

void

at line3975
CarbonInterface setUnit(string$unit,int$value =null)

Set specified unit to new given value.

Parameters

string $unit year, month, day, hour, minute, second or microsecond
int $value new value for given unit

Return Value

CarbonInterface

at line3986
CarbonInterface setUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

Parameters

string $valueUnit unit name to modify
int $value new value for the input unit
string $overflowUnit unit name to not overflow

Return Value

CarbonInterface

at line3996
static setUtf8(bool$utf8)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use UTF-8 language packages on every machine. Set if UTF8 will be used for localized date/time.

Parameters

bool $utf8

at line4011
staticvoid setWeekEndsAt(int|string$day)deprecated

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

Parameters

int|string $day week end day (or 'auto' to get the day before the first day of week from Carbon::getLocale() culture).

Return Value

void

at line4025
staticvoid setWeekStartsAt(int|string$day)deprecated

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

Parameters

int|string $day week start day (or 'auto' to get the first day of week from Carbon::getLocale() culture).

Return Value

void

at line4054
staticvoid setWeekendDays(array$days)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather consider week-end is always saturday and sunday, and if you have some custom week-end days to handle, give to those days an other name and create a macro for them: ``` Carbon::macro('isDayOff', function ($date) { return $date->isSunday() || $date->isMonday(); }); Carbon::macro('isNotDayOff', function ($date) { return !$date->isDayOff(); }); if ($someDate->isDayOff()) ... if ($someDate->isNotDayOff()) ... // Add 5 not-off days $count = 5; while ($someDate->isDayOff() || ($count-- > 0)) { $someDate->addDay(); } ``` Set weekend days

Parameters

array $days

Return Value

void

at line4073
$this|CarbonInterface settings(array$settings)

Set specific options.

  • strictMode: true|false|null
    • monthOverflow: true|false|null
    • yearOverflow: true|false|null
    • humanDiffOptions: int|null
    • toStringFormat: string|Closure|null
    • toJsonFormat: string|Closure|null
    • locale: string|null
    • timezone: \DateTimeZone|string|int|null
    • macros: array|null
    • genericMacros: array|null

Parameters

array $settings

Return Value

$this|CarbonInterface

at line4082
CarbonInterface shiftTimezone(DateTimeZone|string$value)

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

Parameters

DateTimeZone|string $value

Return Value

CarbonInterface

at line4089
staticbool shouldOverflowMonths()

Get the month overflow global behavior (can be overridden in specific instances).

Return Value

bool

at line4096
staticbool shouldOverflowYears()

Get the month overflow global behavior (can be overridden in specific instances).

Return Value

bool

at line4104
since($other =null,$syntax =null,$short =false,$parts =1,$options =null)

Parameters

$other
$syntax
$short
$parts
$options

at line4113
staticstring singularUnit(string$unit)

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

Parameters

string $unit

Return Value

string

at line4130
CarbonInterface startOf(string$unit,array...$params)

Modify to start of current given unit.

Parameters

string $unit
array ...$params mixed> $params

Return Value

CarbonInterface

at line4142
CarbonInterface startOfCentury()

Resets the date to the first day of the century and the time to 00:00:00

Return Value

CarbonInterface

at line4154
CarbonInterface startOfDay()

Resets the time to 00:00:00 start of day

Return Value

CarbonInterface

at line4166
CarbonInterface startOfDecade()

Resets the date to the first day of the decade and the time to 00:00:00

Return Value

CarbonInterface

at line4178
CarbonInterface startOfHour()

Modify to start of current hour, minutes and seconds become 0

Return Value

CarbonInterface

at line4190
CarbonInterface startOfMillennium()

Resets the date to the first day of the millennium and the time to 00:00:00

Return Value

CarbonInterface

at line4202
CarbonInterface startOfMinute()

Modify to start of current minute, seconds become 0

Return Value

CarbonInterface

at line4214
CarbonInterface startOfMonth()

Resets the date to the first day of the month and the time to 00:00:00

Return Value

CarbonInterface

at line4226
CarbonInterface startOfQuarter()

Resets the date to the first day of the quarter and the time to 00:00:00

Return Value

CarbonInterface

at line4240
CarbonInterface startOfSecond()

Modify to start of current second, microseconds become 0

Return Value

CarbonInterface

at line4256
CarbonInterface startOfWeek(int$weekStartsAt =null)

Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line4268
CarbonInterface startOfYear()

Resets the date to the first day of the year and the time to 00:00:00

Return Value

CarbonInterface

at line4284
sub($unit,$value =1,$overflow =null)

Parameters

$unit
$value
$overflow

at line4286
subRealUnit($unit,$value =1)

Parameters

$unit
$value

at line4297
CarbonInterface subUnit(string$unit,int$value =1,bool|null$overflow =null)

Subtract given units to the current instance.

Parameters

string $unit
int $value
bool|null $overflow

Return Value

CarbonInterface

at line4308
CarbonInterface subUnitNoOverflow(string$valueUnit,int$value,string$overflowUnit)

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

Parameters

string $valueUnit unit name to modify
int $value amount to subtract to the input unit
string $overflowUnit unit name to not overflow

Return Value

CarbonInterface

at line4321
CarbonInterface subtract(string|DateInterval$unit,int$value =1,bool|null$overflow =null)

Subtract given units or interval to the current instance.

Parameters

string|DateInterval $unit
int $value
bool|null $overflow

Return Value

CarbonInterface

See also

sub()

at line4329
string timespan($other =null,$timezone =null)

Get the difference in a human readable format in the current locale from current instance to an other instance given (or now if null given).

Parameters

$other
$timezone

Return Value

string

at line4340
CarbonInterface timestamp(float|int|string$unixTimestamp)

Set the instance's timestamp.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $unixTimestamp

Return Value

CarbonInterface

at line4349
CarbonInterface timezone(DateTimeZone|string$value)

Parameters

DateTimeZone|string $value

Return Value

CarbonInterface

at line4399
string to(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given (or now if null given) to current instance.

When comparing a value in the past to default now: 1 hour from now 5 months from now

When comparing a value in the future to default now: 1 hour ago 5 months ago

When comparing a value in the past to another value: 1 hour after 5 months after

When comparing a value in the future to another value: 1 hour before 5 months before

Parameters

Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; if null passed, now will be used as comparison reference; if any other type, it will be converted to date and used as reference.
int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue - 'other' entry (see above) if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options

Return Value

string

at line4411
array toArray()

Get default array representation.

Return Value

array

at line4423
string toAtomString()

Format the instance as ATOM

Return Value

string

at line4435
string toCookieString()

Format the instance as COOKIE

Return Value

string

at line4449
DateTime toDate()

Return Value

DateTime

at line4461
string toDateString()

Format the instance as date

Return Value

string

at line4473
DateTime toDateTime()

Return native DateTime PHP object matching the current instance.

Return Value

DateTime

at line4485
DateTimeImmutable toDateTimeImmutable()

Return native toDateTimeImmutable PHP object matching the current instance.

Return Value

DateTimeImmutable

at line4501
string toDateTimeLocalString(string$unitPrecision ='second')

Format the instance as date and time T-separated with no timezone

Parameters

string $unitPrecision

Return Value

string

at line4515
string toDateTimeString(string$unitPrecision ='second')

Format the instance as date and time

Parameters

string $unitPrecision

Return Value

string

at line4527
string toDayDateTimeString()

Format the instance with day, date and time

Return Value

string

at line4539
string toFormattedDateString()

Format the instance as a readable date

Return Value

string

at line4555
null|string toISOString(bool$keepOffset =false)

Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: 1977-04-22T01:00:00-05:00).

Parameters

bool $keepOffset Pass true to keep the date offset. Else forced to UTC.

Return Value

null|string

at line4562
CarbonImmutable toImmutable()

Return a immutable copy of the instance.

Return Value

CarbonImmutable

at line4574
string toIso8601String()

Format the instance as ISO8601

Return Value

string

at line4588
string toIso8601ZuluString(string$unitPrecision ='second')

Convert the instance to UTC and return as Zulu ISO8601

Parameters

string $unitPrecision

Return Value

string

at line4600
null|string toJSON()

Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.

Return Value

null|string

at line4607
Carbon toMutable()

Return a mutable copy of the instance.

Return Value

Carbon

at line4637
string toNow(int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Get the difference in a human readable format in the current locale from an other instance given to now

Parameters

int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single part)
int $options human diff options

Return Value

string

at line4649
object toObject()

Get default object representation.

Return Value

object

at line4660
CarbonPeriod toPeriod(DateTimeInterface|Carbon|CarbonImmutable|int|null$end =null,int|DateInterval|string|null$interval =null,string|null$unit =null)

Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).

Parameters

DateTimeInterface|Carbon|CarbonImmutable|int|null $end period end date or recurrences count if int
int|DateInterval|string|null $interval period default interval or number of the given $unit
string|null $unit if specified, $interval must be an integer

Return Value

CarbonPeriod

at line4672
string toRfc1036String()

Format the instance as RFC1036

Return Value

string

at line4684
string toRfc1123String()

Format the instance as RFC1123

Return Value

string

at line4696
string toRfc2822String()

Format the instance as RFC2822

Return Value

string

at line4711
string toRfc3339String(bool$extended =false)

Format the instance as RFC3339

Parameters

bool $extended

Return Value

string

at line4723
string toRfc7231String()

Format the instance as RFC7231

Return Value

string

at line4735
string toRfc822String()

Format the instance as RFC822

Return Value

string

at line4747
string toRfc850String()

Format the instance as RFC850

Return Value

string

at line4759
string toRssString()

Format the instance as RSS

Return Value

string

at line4771
string toString()

Returns english human readable complete date string.

Return Value

string

at line4785
string toTimeString(string$unitPrecision ='second')

Format the instance as time

Parameters

string $unitPrecision

Return Value

string

at line4797
string toW3cString()

Format the instance as W3C

Return Value

string

at line4806
staticCarbonInterface today(DateTimeZone|string|null$tz =null)

Create a Carbon instance for today.

Parameters

DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line4815
staticCarbonInterface tomorrow(DateTimeZone|string|null$tz =null)

Create a Carbon instance for tomorrow.

Parameters

DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line4828
string translate(string$key,array$parameters =[],string|int|float|null$number =null,TranslatorInterface|null$translator =null,bool$altNumbers =false)

Translate using translation string or callback available.

Parameters

string $key
array $parameters
string|int|float|null $number
TranslatorInterface|null $translator
bool $altNumbers

Return Value

string

at line4837
string translateNumber(int$number)

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

Parameters

int $number

Return Value

string

at line4855
staticstring translateTimeString(string$timeString,string|null$from =null,string|null$to =null,int$mode =self::TRANSLATE_ALL)

Translate a time string from a locale to an other.

Parameters

string $timeString date/time/duration string to translate (may also contain English)
string|null $from input locale of the $timeString parameter (Carbon::getLocale() by default)
string|null $to output locale of the result returned ("en" by default)
int $mode specify what to translate with options: - self::TRANSLATE_ALL (default) - CarbonInterface::TRANSLATE_MONTHS - CarbonInterface::TRANSLATE_DAYS - CarbonInterface::TRANSLATE_UNITS - CarbonInterface::TRANSLATE_MERIDIEM You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS

Return Value

string

at line4865
string translateTimeStringTo(string$timeString,string|null$to =null)

Translate a time string from the current locale ($date->locale()) to an other.

Parameters

string $timeString time string to translate
string|null $to output locale of the result returned ("en" by default)

Return Value

string

at line4877
staticstring translateWith(TranslatorInterface$translator,string$key,array$parameters =[],null$number =null)

Translate using translation string or callback available.

Parameters

TranslatorInterface $translator
string $key
array $parameters
null $number

Return Value

string

at line4887
string translatedFormat(string$format)

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

Parameters

string $format

Return Value

string

at line4896
CarbonInterface|string tz(DateTimeZone|string$value =null)

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

Parameters

DateTimeZone|string $value

Return Value

CarbonInterface|string

at line4905
int unix()

Return Value

int

at line4941
string until(Carbon|DateTimeInterface|string|array|null$other =null,int|array$syntax =null,bool$short =false,int$parts =1,int$options =null)

Parameters

Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; if null passed, now will be used as comparison reference; if any other type, it will be converted to date and used as reference.
int|array $syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string - if $join is a string, it's used as a joiner glue - if $join is a callable/closure, it get the list of string and should return a string - if $join is an array, the first item will be the default glue, and the second item will be used instead of the glue for the last item - if $join is true, it will be guessed from the locale ('list' translation file entry) - if $join is missing, a space will be used as glue - 'other' entry (see above) if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options

Return Value

string

at line4956
staticvoid useMonthsOverflow(bool$monthsOverflow =true)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method. Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants are available for quarters, years, decade, centuries, millennia (singular and plural forms).

Parameters

bool $monthsOverflow

Return Value

void

See also

settings Indicates if months should be calculated with overflow.

at line4967
static useStrictMode(bool$strictModeEnabled =true)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method.

Parameters

bool $strictModeEnabled

See also

settings Enable the strict mode (or disable with passing false).

at line4982
staticvoid useYearsOverflow(bool$yearsOverflow =true)deprecated

deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather use the ->settings() method. Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants are available for quarters, years, decade, centuries, millennia (singular and plural forms).

Parameters

bool $yearsOverflow

Return Value

void

See also

settings Indicates if years should be calculated with overflow.

at line4989
CarbonInterface utc()

Set the instance's timezone to UTC.

Return Value

CarbonInterface

at line4998
int|CarbonInterface utcOffset(int|null$minuteOffset =null)

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

Parameters

int|null $minuteOffset

Return Value

int|CarbonInterface

at line5005
float valueOf()

Returns the milliseconds timestamps used amongst other by Date javascript objects.

Return Value

float

at line5018
int|CarbonInterface week(int|null$week =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get/set the week number using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

Parameters

int|null $week
int|null $dayOfWeek
int|null $dayOfYear

Return Value

int|CarbonInterface

at line5031
int|CarbonInterface weekYear(int|null$year =null,int|null$dayOfWeek =null,int|null$dayOfYear =null)

Set/get the week number of year using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

Parameters

int|null $year if null, act as a getter, if not null, set the year and return current instance.
int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
int|null $dayOfYear first day of year included in the week #1

Return Value

int|CarbonInterface

at line5040
CarbonInterface|int weekday(int|null$value =null)

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

Parameters

int|null $value new value for weekday if using as setter.

Return Value

CarbonInterface|int

at line5052
int weeksInYear(int|null$dayOfWeek =null,int|null$dayOfYear =null)

Get the number of weeks of the current week-year using given first day of week and first day of year included in the first week. Or use US format if no settings given (Sunday / Jan 6).

Parameters

int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday)
int|null $dayOfYear first day of year included in the week #1

Return Value

int

at line5066
staticmixed withTestNow(Closure|CarbonInterface|string|false|null$testNow =null,Closure|null$callback =null)

Temporarily sets a static date to be used within the callback.

Using setTestNow to set the date, executing the callback, then clearing the test instance.

/!\ Use this method for unit tests only.

Parameters

Closure|CarbonInterface|string|false|null $testNow real or mock Carbon instance
Closure|null $callback

Return Value

mixed

at line5075
staticCarbonInterface yesterday(DateTimeZone|string|null$tz =null)

Create a Carbon instance for yesterday.

Parameters

DateTimeZone|string|null $tz

Return Value

CarbonInterface

at line520
bool isUtc()

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

Return Value

bool

at line520
bool isLocal()

Check if the current instance has non-UTC timezone.

Return Value

bool

at line520
bool isValid()

Check if the current instance is a valid date.

Return Value

bool

at line520
bool isDST()

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

Return Value

bool

at line520
bool isSunday()

Checks if the instance day is sunday.

Return Value

bool

at line520
bool isMonday()

Checks if the instance day is monday.

Return Value

bool

at line520
bool isTuesday()

Checks if the instance day is tuesday.

Return Value

bool

at line520
bool isWednesday()

Checks if the instance day is wednesday.

Return Value

bool

at line520
bool isThursday()

Checks if the instance day is thursday.

Return Value

bool

at line520
bool isFriday()

Checks if the instance day is friday.

Return Value

bool

at line520
bool isSaturday()

Checks if the instance day is saturday.

Return Value

bool

at line520
bool isSameYear(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentYear()

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

Return Value

bool

at line520
bool isNextYear()

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

Return Value

bool

at line520
bool isLastYear()

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

Return Value

bool

at line520
bool isSameWeek(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentWeek()

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

Return Value

bool

at line520
bool isNextWeek()

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

Return Value

bool

at line520
bool isLastWeek()

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

Return Value

bool

at line520
bool isSameDay(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentDay()

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

Return Value

bool

at line520
bool isNextDay()

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

Return Value

bool

at line520
bool isLastDay()

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

Return Value

bool

at line520
bool isSameHour(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentHour()

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

Return Value

bool

at line520
bool isNextHour()

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

Return Value

bool

at line520
bool isLastHour()

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

Return Value

bool

at line520
bool isSameMinute(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentMinute()

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

Return Value

bool

at line520
bool isNextMinute()

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

Return Value

bool

at line520
bool isLastMinute()

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

Return Value

bool

at line520
bool isSameSecond(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentSecond()

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

Return Value

bool

at line520
bool isNextSecond()

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

Return Value

bool

at line520
bool isLastSecond()

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

Return Value

bool

at line520
bool isSameMicro(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentMicro()

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

Return Value

bool

at line520
bool isNextMicro()

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

Return Value

bool

at line520
bool isLastMicro()

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

Return Value

bool

at line520
bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentMicrosecond()

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

Return Value

bool

at line520
bool isNextMicrosecond()

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

Return Value

bool

at line520
bool isLastMicrosecond()

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

Return Value

bool

at line520
bool isCurrentMonth()

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

Return Value

bool

at line520
bool isNextMonth()

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

Return Value

bool

at line520
bool isLastMonth()

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

Return Value

bool

at line520
bool isCurrentQuarter()

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

Return Value

bool

at line520
bool isNextQuarter()

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

Return Value

bool

at line520
bool isLastQuarter()

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

Return Value

bool

at line520
bool isSameDecade(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentDecade()

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

Return Value

bool

at line520
bool isNextDecade()

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

Return Value

bool

at line520
bool isLastDecade()

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

Return Value

bool

at line520
bool isSameCentury(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentCentury()

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

Return Value

bool

at line520
bool isNextCentury()

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

Return Value

bool

at line520
bool isLastCentury()

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

Return Value

bool

at line520
bool isSameMillennium(Carbon|DateTimeInterface|string|null $date =null)

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

Parameters

Carbon|DateTimeInterface|string|null $date

Return Value

bool

at line520
bool isCurrentMillennium()

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

Return Value

bool

at line520
bool isNextMillennium()

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

Return Value

bool

at line520
bool isLastMillennium()

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

Return Value

bool

at line520
CarbonInterface years(int $value)

Set current instance year to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface year(int $value)

Set current instance year to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setYears(int $value)

Set current instance year to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setYear(int $value)

Set current instance year to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface months(int $value)

Set current instance month to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface month(int $value)

Set current instance month to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMonths(int $value)

Set current instance month to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMonth(int $value)

Set current instance month to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface days(int $value)

Set current instance day to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface day(int $value)

Set current instance day to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setDays(int $value)

Set current instance day to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setDay(int $value)

Set current instance day to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface hours(int $value)

Set current instance hour to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface hour(int $value)

Set current instance hour to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setHours(int $value)

Set current instance hour to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setHour(int $value)

Set current instance hour to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface minutes(int $value)

Set current instance minute to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface minute(int $value)

Set current instance minute to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMinutes(int $value)

Set current instance minute to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMinute(int $value)

Set current instance minute to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface seconds(int $value)

Set current instance second to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface second(int $value)

Set current instance second to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setSeconds(int $value)

Set current instance second to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setSecond(int $value)

Set current instance second to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface millis(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface milli(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMillis(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMilli(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface milliseconds(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface millisecond(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMilliseconds(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMillisecond(int $value)

Set current instance millisecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface micros(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface micro(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMicros(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMicro(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface microseconds(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface microsecond(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMicroseconds(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface setMicrosecond(int $value)

Set current instance microsecond to the given value.

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYears(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYear()

Add one year to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subYears(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subYear()

Sub one year to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addYearsWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYearWithOverflow()

Add one year to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subYearsWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subYearWithOverflow()

Sub one year to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addYearsWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYearWithoutOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subYearsWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subYearWithoutOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addYearsWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYearWithNoOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subYearsWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subYearWithNoOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addYearsNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addYearNoOverflow()

Add one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subYearsNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subYearNoOverflow()

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addMonths(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMonth()

Add one month to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMonths(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMonth()

Sub one month to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMonthsWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMonthWithOverflow()

Add one month to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subMonthsWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMonthWithOverflow()

Sub one month to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addMonthsWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMonthWithoutOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMonthsWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMonthWithoutOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addMonthsWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMonthWithNoOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMonthsWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMonthWithNoOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addMonthsNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMonthNoOverflow()

Add one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMonthsNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMonthNoOverflow()

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addDays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDay()

Add one day to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subDays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDay()

Sub one day to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addHours(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addHour()

Add one hour to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subHours(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subHour()

Sub one hour to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMinutes(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMinute()

Add one minute to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMinutes(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMinute()

Sub one minute to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addSeconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addSecond()

Add one second to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subSeconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subSecond()

Sub one second to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMillis(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMilli()

Add one millisecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMillis(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMilli()

Sub one millisecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMilliseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillisecond()

Add one millisecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMilliseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillisecond()

Sub one millisecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMicros(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMicro()

Add one microsecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMicros(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMicro()

Sub one microsecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMicroseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMicrosecond()

Add one microsecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMicroseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMicrosecond()

Sub one microsecond to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMillennia(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillennium()

Add one millennium to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subMillennia(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillennium()

Sub one millennium to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniaWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniumWithOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniaWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniumWithOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniaWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniumWithoutOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniaWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniumWithoutOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniaWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniumWithNoOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniaWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniumWithNoOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniaNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addMillenniumNoOverflow()

Add one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniaNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subMillenniumNoOverflow()

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addCenturies(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addCentury()

Add one century to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subCenturies(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subCentury()

Sub one century to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addCenturiesWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addCenturyWithOverflow()

Add one century to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subCenturiesWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subCenturyWithOverflow()

Sub one century to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addCenturiesWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addCenturyWithoutOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subCenturiesWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subCenturyWithoutOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addCenturiesWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addCenturyWithNoOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subCenturiesWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subCenturyWithNoOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addCenturiesNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addCenturyNoOverflow()

Add one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subCenturiesNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subCenturyNoOverflow()

Sub one century to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addDecades(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDecade()

Add one decade to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subDecades(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDecade()

Sub one decade to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addDecadesWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDecadeWithOverflow()

Add one decade to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subDecadesWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDecadeWithOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addDecadesWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDecadeWithoutOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subDecadesWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDecadeWithoutOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addDecadesWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDecadeWithNoOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subDecadesWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDecadeWithNoOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addDecadesNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addDecadeNoOverflow()

Add one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subDecadesNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subDecadeNoOverflow()

Sub one decade to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addQuarters(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addQuarter()

Add one quarter to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subQuarters(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subQuarter()

Sub one quarter to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addQuartersWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addQuarterWithOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface subQuartersWithOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subQuarterWithOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly allowed.

Return Value

CarbonInterface

at line520
CarbonInterface addQuartersWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addQuarterWithoutOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subQuartersWithoutOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subQuarterWithoutOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addQuartersWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addQuarterWithNoOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subQuartersWithNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subQuarterWithNoOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addQuartersNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addQuarterNoOverflow()

Add one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface subQuartersNoOverflow(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subQuarterNoOverflow()

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.

Return Value

CarbonInterface

at line520
CarbonInterface addWeeks(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addWeek()

Add one week to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subWeeks(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subWeek()

Sub one week to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addWeekdays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addWeekday()

Add one weekday to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface subWeekdays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subWeekday()

Sub one weekday to the instance (using date interval).

Return Value

CarbonInterface

at line520
CarbonInterface addRealMicros(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMicro()

Add one microsecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMicros(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMicro()

Sub one microsecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod microsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMicroseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMicrosecond()

Add one microsecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMicroseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMicrosecond()

Sub one microsecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod microsecondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMillis(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMilli()

Add one millisecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMillis(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMilli()

Sub one millisecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod millisUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMilliseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMillisecond()

Add one millisecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMilliseconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMillisecond()

Sub one millisecond to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod millisecondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealSeconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealSecond()

Add one second to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealSeconds(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealSecond()

Sub one second to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod secondsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMinutes(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMinute()

Add one minute to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMinutes(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMinute()

Sub one minute to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod minutesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealHours(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealHour()

Add one hour to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealHours(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealHour()

Sub one hour to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod hoursUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealDays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealDay()

Add one day to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealDays(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealDay()

Sub one day to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod daysUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealWeeks(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealWeek()

Add one week to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealWeeks(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealWeek()

Sub one week to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod weeksUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMonths(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMonth()

Add one month to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMonths(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMonth()

Sub one month to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod monthsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealQuarters(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealQuarter()

Add one quarter to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealQuarters(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealQuarter()

Sub one quarter to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod quartersUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealYears(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealYear()

Add one year to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealYears(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealYear()

Sub one year to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod yearsUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealDecades(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealDecade()

Add one decade to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealDecades(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealDecade()

Sub one decade to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod decadesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealCenturies(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealCentury()

Add one century to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealCenturies(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealCentury()

Sub one century to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod centuriesUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface addRealMillennia(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface addRealMillennium()

Add one millennium to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonInterface subRealMillennia(int $value =1)

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

Parameters

int $value

Return Value

CarbonInterface

at line520
CarbonInterface subRealMillennium()

Sub one millennium to the instance (using timestamp).

Return Value

CarbonInterface

at line520
CarbonPeriod millenniaUntil($endDate =null,int $factor =1)

Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given.

Parameters

$endDate
int $factor

Return Value

CarbonPeriod

at line520
CarbonInterface roundYear(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundYears(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorYear(float $precision =1)

Truncate the current instance year with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorYears(float $precision =1)

Truncate the current instance year with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilYear(float $precision =1)

Ceil the current instance year with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilYears(float $precision =1)

Ceil the current instance year with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundMonth(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundMonths(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorMonth(float $precision =1)

Truncate the current instance month with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorMonths(float $precision =1)

Truncate the current instance month with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMonth(float $precision =1)

Ceil the current instance month with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMonths(float $precision =1)

Ceil the current instance month with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundDay(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundDays(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorDay(float $precision =1)

Truncate the current instance day with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorDays(float $precision =1)

Truncate the current instance day with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilDay(float $precision =1)

Ceil the current instance day with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilDays(float $precision =1)

Ceil the current instance day with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundHour(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundHours(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorHour(float $precision =1)

Truncate the current instance hour with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorHours(float $precision =1)

Truncate the current instance hour with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilHour(float $precision =1)

Ceil the current instance hour with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilHours(float $precision =1)

Ceil the current instance hour with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundMinute(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundMinutes(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorMinute(float $precision =1)

Truncate the current instance minute with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorMinutes(float $precision =1)

Truncate the current instance minute with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMinute(float $precision =1)

Ceil the current instance minute with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMinutes(float $precision =1)

Ceil the current instance minute with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundSecond(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundSeconds(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorSecond(float $precision =1)

Truncate the current instance second with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorSeconds(float $precision =1)

Truncate the current instance second with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilSecond(float $precision =1)

Ceil the current instance second with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilSeconds(float $precision =1)

Ceil the current instance second with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundMillennium(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundMillennia(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorMillennium(float $precision =1)

Truncate the current instance millennium with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorMillennia(float $precision =1)

Truncate the current instance millennium with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMillennium(float $precision =1)

Ceil the current instance millennium with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMillennia(float $precision =1)

Ceil the current instance millennium with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundCentury(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundCenturies(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorCentury(float $precision =1)

Truncate the current instance century with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorCenturies(float $precision =1)

Truncate the current instance century with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilCentury(float $precision =1)

Ceil the current instance century with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilCenturies(float $precision =1)

Ceil the current instance century with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundDecade(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundDecades(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorDecade(float $precision =1)

Truncate the current instance decade with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorDecades(float $precision =1)

Truncate the current instance decade with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilDecade(float $precision =1)

Ceil the current instance decade with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilDecades(float $precision =1)

Ceil the current instance decade with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundQuarter(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundQuarters(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorQuarter(float $precision =1)

Truncate the current instance quarter with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorQuarters(float $precision =1)

Truncate the current instance quarter with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilQuarter(float $precision =1)

Ceil the current instance quarter with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilQuarters(float $precision =1)

Ceil the current instance quarter with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundMillisecond(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundMilliseconds(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorMillisecond(float $precision =1)

Truncate the current instance millisecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorMilliseconds(float $precision =1)

Truncate the current instance millisecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMillisecond(float $precision =1)

Ceil the current instance millisecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMilliseconds(float $precision =1)

Ceil the current instance millisecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface roundMicrosecond(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface roundMicroseconds(float $precision =1,string $function ="round")

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

Parameters

float $precision
string $function

Return Value

CarbonInterface

at line520
CarbonInterface floorMicrosecond(float $precision =1)

Truncate the current instance microsecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface floorMicroseconds(float $precision =1)

Truncate the current instance microsecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMicrosecond(float $precision =1)

Ceil the current instance microsecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
CarbonInterface ceilMicroseconds(float $precision =1)

Ceil the current instance microsecond with given precision.

Parameters

float $precision

Return Value

CarbonInterface

at line520
string shortAbsoluteDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string longAbsoluteDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string shortRelativeDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string longRelativeDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string shortRelativeToNowDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string longRelativeToNowDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string shortRelativeToOtherDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string

at line520
string longRelativeToOtherDiffForHumans(DateTimeInterface $other =null,int $parts =1)

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

Parameters

DateTimeInterface $other
int $parts

Return Value

string