Skip to content

Date

Date · Type

A Date is a single moment in time, down to the second. You get one from mash.date, from a file’s modified, from a field that holds a date, or from an event. It has a long list of methods, and the generated list below is complete. This page shows how they fit together.

Read the parts as properties. year, month, day, hour, minute, second, dayOfWeek (0 is Sunday), dayOfYear, weekOfYear, quarter, daysInMonth and timestamp (seconds since 1970).

Change it with add and sub. addDays, addWeeks, addMonths, addYears, addHours, addMinutes and their sub twins. Each one changes the date itself and returns it, so calls chain: d.copy().addMonths(1).startOfMonth(). Add a negative number to go back.

Jump with startOf and endOf. startOfDay, startOfWeek, startOfMonth, startOfYear, and the matching endOf methods. next("friday") and previous("monday") move to a named day. setDate(y, m, d) and setTime(h, i, s) set parts directly.

Compare with <, > and ==, or by name. lt, gt, eq, between(a, b), isSameDay(other), isPast(), isFuture(), isWeekend(), isTuesday() and so on.

Measure with diffIn.... diffInDays, diffInHours, diffInMinutes and friends. They return a number, often with a fraction, and they’re signed.

Write with format or isoFormat. format uses PHP’s letters (Y year, m month, d day, H:i time, D and l day names, j day without a leading zero, M and F month names). isoFormat uses the letter style from moment.js (dddd D MMMM YYYY). toDateString() gives 2026-11-03 and toIso8601String() gives the full timestamp with its offset. diffForHumans() says “6 hours ago”, relative to now.

Step through the next few working days:

set d to mash.date.parse("2026-11-03")
set i to 0
while i is less than 4
d.addWeekday()
printline d.format("D j M")
increment i by 1
end
Wed 4 Nov
Thu 5 Nov
Fri 6 Nov
Mon 9 Nov

Find the first and last day of a month:

set d to mash.date.parse("2026-02-14")
printline d.copy().startOfMonth().format("Y-m-d")
printline d.copy().endOfMonth().format("Y-m-d")
2026-02-01
2026-02-28

Measure the gap between two dates:

set a to mash.date.parse("2026-11-03 14:05:00")
set b to mash.date.parse("2026-11-03 18:35:00")
printline a.diffInHours(b)
printline b.diffInHours(a)
printline b.diffInHours(a, true)
4.5
-4.5
4.5

Change the time of day and print it several ways:

set d to mash.date.parse("2026-11-03 14:05:09")
d.setTime(9, 0)
printline d.format("H:i:s")
printline d.isoFormat("dddd D MMMM")
printline d.toDateString()
09:00:00
Tuesday 3 November
2026-11-03
  • Dates change in place. d.addDays(30) moves d and returns the same date. Use copy() first, or clone(d), when you need the original too. Plain assignment (set later to start) doesn’t copy.
  • diffInDays(other) is signed: positive when other is later. Pass true as the second argument for the plain distance.
  • addMonth can overflow. From 31 January it lands in March. addMonthNoOverflow stops at the end of February.
  • dayOfWeek starts at Sunday = 0. Name the day (isMonday()) when you can.
  • Two dates with different times aren’t ==. To ask “same day”, use isSameDay, or compare toDateString() values.
  • Time zones. format shows the date in its own time zone. Add P to show the offset.

mash.date, and Talking to the outside world for the first look at dates.

NameTypeDescription
ageint
centuriesInMillenniumint
centuryint
centuryOfMillenniumint
dayint
dayNamestring
dayOfCenturyint
dayOfDecadeint
dayOfMillenniumint
dayOfMonthint
dayOfQuarterint
dayOfWeekint
dayOfWeekIsoint
dayOfYearint
daysInCenturyint
daysInDecadeint
daysInMillenniumint
daysInMonthint
daysInQuarterint
daysInWeekint
daysInYearint
decadeint
decadeOfCenturyint
decadeOfMillenniumint
decadesInCenturyint
decadesInMillenniumint
dstbool
englishDayOfWeekstring
englishMonthstring
firstWeekDayint
hourint
hourOfCenturyint
hourOfDayint
hourOfDecadeint
hourOfMillenniumint
hourOfMonthint
hourOfQuarterint
hourOfWeekint
hourOfYearint
hoursInCenturyint
hoursInDayint
hoursInDecadeint
hoursInMillenniumint
hoursInMonthint
hoursInQuarterint
hoursInWeekint
hoursInYearint
isoWeekint
isoWeekYearint
isoWeeksInYearint
lastWeekDayint
latinMeridiemstring
latinUpperMeridiemstring
localbool
localestring
localeDayOfWeekstring
localeMonthstring
meridiemstring
microint
microsecondint
microsecondOfCenturyint
microsecondOfDayint
microsecondOfDecadeint
microsecondOfHourint
microsecondOfMillenniumint
microsecondOfMillisecondint
microsecondOfMinuteint
microsecondOfMonthint
microsecondOfQuarterint
microsecondOfSecondint
microsecondOfWeekint
microsecondOfYearint
microsecondsInCenturyint
microsecondsInDayint
microsecondsInDecadeint
microsecondsInHourint
microsecondsInMillenniumint
microsecondsInMillisecondint
microsecondsInMinuteint
microsecondsInMonthint
microsecondsInQuarterint
microsecondsInSecondint
microsecondsInWeekint
microsecondsInYearint
millenniumint
milliint
millisecondint
millisecondOfCenturyint
millisecondOfDayint
millisecondOfDecadeint
millisecondOfHourint
millisecondOfMillenniumint
millisecondOfMinuteint
millisecondOfMonthint
millisecondOfQuarterint
millisecondOfSecondint
millisecondOfWeekint
millisecondOfYearint
millisecondsint
millisecondsInCenturyint
millisecondsInDayint
millisecondsInDecadeint
millisecondsInHourint
millisecondsInMillenniumint
millisecondsInMinuteint
millisecondsInMonthint
millisecondsInQuarterint
millisecondsInSecondint
millisecondsInWeekint
millisecondsInYearint
minDayNamestring
minuteint
minuteOfCenturyint
minuteOfDayint
minuteOfDecadeint
minuteOfHourint
minuteOfMillenniumint
minuteOfMonthint
minuteOfQuarterint
minuteOfWeekint
minuteOfYearint
minutesInCenturyint
minutesInDayint
minutesInDecadeint
minutesInHourint
minutesInMillenniumint
minutesInMonthint
minutesInQuarterint
minutesInWeekint
minutesInYearint
monthint
monthNamestring
monthOfCenturyint
monthOfDecadeint
monthOfMillenniumint
monthOfQuarterint
monthOfYearint
monthsInCenturyint
monthsInDecadeint
monthsInMillenniumint
monthsInQuarterint
monthsInYearint
noZeroHourint
offsetint
offsetHoursint
offsetMinutesint
quarterint
quarterOfCenturyint
quarterOfDecadeint
quarterOfMillenniumint
quarterOfYearint
quartersInCenturyint
quartersInDecadeint
quartersInMillenniumint
quartersInYearint
secondint
secondOfCenturyint
secondOfDayint
secondOfDecadeint
secondOfHourint
secondOfMillenniumint
secondOfMinuteint
secondOfMonthint
secondOfQuarterint
secondOfWeekint
secondOfYearint
secondsInCenturyint
secondsInDayint
secondsInDecadeint
secondsInHourint
secondsInMillenniumint
secondsInMinuteint
secondsInMonthint
secondsInQuarterint
secondsInWeekint
secondsInYearint
shortDayNamestring
shortEnglishDayOfWeekstring
shortEnglishMonthstring
shortLocaleDayOfWeekstring
shortLocaleMonthstring
shortMonthNamestring
timestampintfloat
timezoneCarbonTimeZone
timezoneAbbreviatedNamestring
timezoneNamestring
tzCarbonTimeZone
tzAbbrNamestring
tzNamestring
upperMeridiemstring
utcbool
weekint
weekNumberInMonthint
weekOfCenturyint
weekOfDecadeint
weekOfMillenniumint
weekOfMonthint
weekOfQuarterint
weekOfYearint
weekYearint
weeksInCenturyint
weeksInDecadeint
weeksInMillenniumint
weeksInMonthint
weeksInQuarterint
weeksInYearint
yearint
yearIsoint
yearOfCenturyint
yearOfDecadeint
yearOfMillenniumint
yearsInCenturyint
yearsInDecadeint
yearsInMillenniumint
Changes the value
date.add(unit: mixed, value?: mixed = 1, overflow?: bool) → Date

Add given units or interval to the current instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

$date->add('hour', 3)
$date->add(15, 'days')
$date->add(CarbonInterval::days(4))
Changes the value
date.addCenturies(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturiesNoOverflow(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturiesWithNoOverflow(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturiesWithOverflow(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturiesWithoutOverflow(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCentury() → Date

Add one century to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturyNoOverflow() → Date

Add one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturyWithNoOverflow() → Date

Add one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturyWithOverflow() → Date

Add one century to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addCenturyWithoutOverflow() → Date

Add one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDay() → Date

Add one day to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDays(value?: int|float) → Date

Add days (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecade() → Date

Add one decade to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadeNoOverflow() → Date

Add one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadeWithNoOverflow() → Date

Add one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadeWithOverflow() → Date

Add one decade to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadeWithoutOverflow() → Date

Add one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecades(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadesNoOverflow(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadesWithNoOverflow(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadesWithOverflow(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addDecadesWithoutOverflow(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addHour() → Date

Add one hour to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addHours(value?: int|float) → Date

Add hours (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMicro() → Date

Add one microsecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMicros(value?: int|float) → Date

Add microseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMicrosecond() → Date

Add one microsecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMicroseconds(value?: int|float) → Date

Add microseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillennia(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniaNoOverflow(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniaWithNoOverflow(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniaWithOverflow(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniaWithoutOverflow(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillennium() → Date

Add one millennium to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniumNoOverflow() → Date

Add one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniumWithNoOverflow() → Date

Add one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniumWithOverflow() → Date

Add one millennium to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillenniumWithoutOverflow() → Date

Add one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMilli() → Date

Add one millisecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillis(value?: int|float) → Date

Add milliseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMillisecond() → Date

Add one millisecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMilliseconds(value?: int|float) → Date

Add milliseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMinute() → Date

Add one minute to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMinutes(value?: int|float) → Date

Add minutes (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonth() → Date

Add one month to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthNoOverflow() → Date

Add one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthWithNoOverflow() → Date

Add one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthWithOverflow() → Date

Add one month to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthWithoutOverflow() → Date

Add one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonths(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthsNoOverflow(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthsWithNoOverflow(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthsWithOverflow(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addMonthsWithoutOverflow(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarter() → Date

Add one quarter to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarterNoOverflow() → Date

Add one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarterWithNoOverflow() → Date

Add one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarterWithOverflow() → Date

Add one quarter to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarterWithoutOverflow() → Date

Add one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuarters(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuartersNoOverflow(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuartersWithNoOverflow(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuartersWithOverflow(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addQuartersWithoutOverflow(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addRealUnit(unit: string, value?: int = 1) → Date

Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addSecond() → Date

Add one second to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addSeconds(value?: int|float) → Date

Add seconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCCenturies(value?: int|float) → Date

Add centuries (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCCentury() → Date

Add one century to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCDay() → Date

Add one day to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCDays(value?: int|float) → Date

Add days (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCDecade() → Date

Add one decade to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCDecades(value?: int|float) → Date

Add decades (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCHour() → Date

Add one hour to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCHours(value?: int|float) → Date

Add hours (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMicro() → Date

Add one microsecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMicros(value?: int|float) → Date

Add microseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMicrosecond() → Date

Add one microsecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMicroseconds(value?: int|float) → Date

Add microseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMillennia(value?: int|float) → Date

Add millennia (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMillennium() → Date

Add one millennium to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMilli() → Date

Add one millisecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMillis(value?: int|float) → Date

Add milliseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMillisecond() → Date

Add one millisecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMilliseconds(value?: int|float) → Date

Add milliseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMinute() → Date

Add one minute to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMinutes(value?: int|float) → Date

Add minutes (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMonth() → Date

Add one month to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCMonths(value?: int|float) → Date

Add months (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCQuarter() → Date

Add one quarter to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCQuarters(value?: int|float) → Date

Add quarters (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCSecond() → Date

Add one second to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCSeconds(value?: int|float) → Date

Add seconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCUnit(unit: string, value?: int = 1) → Date

Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCWeek() → Date

Add one week to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCWeeks(value?: int|float) → Date

Add weeks (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCYear() → Date

Add one year to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUTCYears(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUnit(unit: Unit, value?: mixed = 1, overflow?: bool) → Date

Add given units to the current instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addUnitNoOverflow(valueUnit: string, value: int, overflowUnit: string) → Date

Add any unit to a new value without overflowing current other unit given. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addWeek() → Date

Add one week to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addWeekday() → Date

Add one weekday to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addWeekdays(value?: int|float) → Date

Add weekdays (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addWeeks(value?: int|float) → Date

Add weeks (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYear() → Date

Add one year to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearNoOverflow() → Date

Add one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearWithNoOverflow() → Date

Add one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearWithOverflow() → Date

Add one year to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearWithoutOverflow() → Date

Add one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYears(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearsNoOverflow(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearsWithNoOverflow(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearsWithOverflow(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.addYearsWithoutOverflow(value?: int|float) → Date

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.ago(syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

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

date.average(date?: Date) → Date

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

date.avoidMutation() → Date

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.

date.between(date1: DateTimeInterface, date2: DateTimeInterface, equal?: bool = true) → bool

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.

Carbon::parse(‘2018-07-25’)->between(‘2018-07-14’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->between(‘2018-08-01’, ‘2018-08-20’); // false Carbon::parse(‘2018-07-25’)->between(‘2018-07-25’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->between(‘2018-07-25’, ‘2018-08-01’, false); // false

date.betweenExcluded(date1: DateTimeInterface, date2: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25’)->betweenExcluded(‘2018-07-14’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->betweenExcluded(‘2018-08-01’, ‘2018-08-20’); // false Carbon::parse(‘2018-07-25’)->betweenExcluded(‘2018-07-25’, ‘2018-08-01’); // false

date.betweenIncluded(date1: DateTimeInterface, date2: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25’)->betweenIncluded(‘2018-07-14’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->betweenIncluded(‘2018-08-01’, ‘2018-08-20’); // false Carbon::parse(‘2018-07-25’)->betweenIncluded(‘2018-07-25’, ‘2018-08-01’); // true

date.calendar(referenceTime?: mixed, formats?: array = []) → string

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.

date.carbonize(date?: Date) → Date

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

Changes the value
date.ceil(precision?: DateInterval = 1) → Date

Ceil the current instance second with given precision if specified. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilCenturies(precision?: float) → Date

Ceil the current instance century with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilCentury(precision?: float) → Date

Ceil the current instance century with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilDay(precision?: float) → Date

Ceil the current instance day with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilDays(precision?: float) → Date

Ceil the current instance day with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilDecade(precision?: float) → Date

Ceil the current instance decade with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilDecades(precision?: float) → Date

Ceil the current instance decade with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilHour(precision?: float) → Date

Ceil the current instance hour with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilHours(precision?: float) → Date

Ceil the current instance hour with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMicrosecond(precision?: float) → Date

Ceil the current instance microsecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMicroseconds(precision?: float) → Date

Ceil the current instance microsecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMillennia(precision?: float) → Date

Ceil the current instance millennium with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMillennium(precision?: float) → Date

Ceil the current instance millennium with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMillisecond(precision?: float) → Date

Ceil the current instance millisecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMilliseconds(precision?: float) → Date

Ceil the current instance millisecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMinute(precision?: float) → Date

Ceil the current instance minute with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMinutes(precision?: float) → Date

Ceil the current instance minute with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMonth(precision?: float) → Date

Ceil the current instance month with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilMonths(precision?: float) → Date

Ceil the current instance month with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilQuarter(precision?: float) → Date

Ceil the current instance quarter with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilQuarters(precision?: float) → Date

Ceil the current instance quarter with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilSecond(precision?: float) → Date

Ceil the current instance second with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilSeconds(precision?: float) → Date

Ceil the current instance second with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilUnit(unit: string, precision?: DateInterval = 1) → Date

Ceil the current instance at the given unit with given precision if specified. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilWeek(weekStartsAt?: WeekDay) → Date

Ceil the current instance week. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilYear(precision?: float) → Date

Ceil the current instance year with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.ceilYears(precision?: float) → Date

Ceil the current instance year with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.centuriesInMillennium() → int

Return the number of centuries contained in the current millennium

date.centuriesUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.centuryOfMillennium(century?: ?int) → int|static

Return the value of the century starting from the beginning of the current millennium when called with no parameters, change the current century when called with an integer value

date.change(modifier: string) → Date

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

echo Carbon::now()->change(‘next 2pm’);

date.cleanupDumpProperties() → Date

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)

date.clone() → Date

No description yet.

date.closest(date1: mixed, date2: Date) → Date

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

date.copy() → Date

Get a copy of the instance.

Changes the value
date.day(value: int) → Date

Set current instance day to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.dayOfCentury(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current century when called with no parameters, change the current day when called with an integer value

date.dayOfDecade(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current decade when called with no parameters, change the current day when called with an integer value

date.dayOfMillennium(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current millennium when called with no parameters, change the current day when called with an integer value

date.dayOfMonth(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current month when called with no parameters, change the current day when called with an integer value

date.dayOfQuarter(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current quarter when called with no parameters, change the current day when called with an integer value

date.dayOfWeek(day?: ?int) → int|static

Return the value of the day starting from the beginning of the current week when called with no parameters, change the current day when called with an integer value

date.dayOfYear(value?: int) → Date

Get/set the day of year.

date.days(value: int) → Date

Set current instance day to the given value.

date.daysInCentury() → int

Return the number of days contained in the current century

date.daysInDecade() → int

Return the number of days contained in the current decade

date.daysInMillennium() → int

Return the number of days contained in the current millennium

date.daysInMonth() → int

Return the number of days contained in the current month

date.daysInQuarter() → int

Return the number of days contained in the current quarter

date.daysInWeek() → int

Return the number of days contained in the current week

date.daysInYear() → int

Return the number of days contained in the current year

date.daysUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.decadeOfCentury(decade?: ?int) → int|static

Return the value of the decade starting from the beginning of the current century when called with no parameters, change the current decade when called with an integer value

date.decadeOfMillennium(decade?: ?int) → int|static

Return the value of the decade starting from the beginning of the current millennium when called with no parameters, change the current decade when called with an integer value

date.decadesInCentury() → int

Return the number of decades contained in the current century

date.decadesInMillennium() → int

Return the number of decades contained in the current millennium

date.decadesUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.diff(date?: mixed, absolute?: bool = false, skip?: array = []) → CarbonInterval

No description yet.

date.diffAsCarbonInterval(date?: mixed, absolute?: bool = false, skip?: array = []) → CarbonInterval

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).

date.diffAsDateInterval(date?: mixed, absolute?: bool = false) → DateInterval

Get the difference as a DateInterval instance. Return relative interval (negative if $absolute flag is not set to true and the given date is before current one).

date.diffFiltered(ci: CarbonInterval, callback: Block, date?: mixed, absolute?: bool = false) → int

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

date.diffForHumans(other?: mixed, syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

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).

echo Carbon::tomorrow()->diffForHumans() . “\n”; echo Carbon::tomorrow()->diffForHumans([‘parts’ => 2]) . “\n”; echo Carbon::tomorrow()->diffForHumans([‘parts’ => 3, ‘join’ => true]) . “\n”; echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . “\n”; echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), [‘short’ => true]) . “\n”;

date.diffInDays(date?: mixed, absolute?: bool = false, utc?: bool = false) → float

Get the difference in days.

date.diffInDaysFiltered(callback: Block, date?: mixed, absolute?: bool = false) → int

Get the difference in days using a filter closure.

date.diffInHours(date?: mixed, absolute?: bool = false) → float

Get the difference in hours.

date.diffInHoursFiltered(callback: Block, date?: mixed, absolute?: bool = false) → int

Get the difference in hours using a filter closure.

date.diffInMicroseconds(date?: mixed, absolute?: bool = false) → float

Get the difference in microseconds.

date.diffInMilliseconds(date?: mixed, absolute?: bool = false) → float

Get the difference in milliseconds.

date.diffInMinutes(date?: mixed, absolute?: bool = false) → float

Get the difference in minutes.

date.diffInMonths(date?: mixed, absolute?: bool = false, utc?: bool = false) → float

Get the difference in months.

date.diffInQuarters(date?: mixed, absolute?: bool = false, utc?: bool = false) → float

Get the difference in quarters.

date.diffInSeconds(date?: mixed, absolute?: bool = false) → float

Get the difference in seconds.

date.diffInUTCCenturies(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of centuries.

date.diffInUTCDays(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of days.

date.diffInUTCDecades(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of decades.

date.diffInUTCHours(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of hours.

date.diffInUTCMicros(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of microseconds.

date.diffInUTCMicroseconds(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of microseconds.

date.diffInUTCMillennia(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of millennia.

date.diffInUTCMillis(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of milliseconds.

date.diffInUTCMilliseconds(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of milliseconds.

date.diffInUTCMinutes(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of minutes.

date.diffInUTCMonths(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of months.

date.diffInUTCQuarters(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of quarters.

date.diffInUTCSeconds(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of seconds.

date.diffInUTCWeeks(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of weeks.

date.diffInUTCYears(date: DateTimeInterface|string|null, absolute?: bool) → float

Convert current and given date in UTC timezone and return a floating number of years.

date.diffInUnit(unit: Unit, date?: mixed, absolute?: bool = false, utc?: bool = false) → float

No description yet.

date.diffInWeekdays(date?: mixed, absolute?: bool = false) → int

Get the difference in weekdays.

date.diffInWeekendDays(date?: mixed, absolute?: bool = false) → int

Get the difference in weekend days using a filter.

date.diffInWeeks(date?: mixed, absolute?: bool = false, utc?: bool = false) → float

Get the difference in weeks.

date.diffInYears(date?: mixed, absolute?: bool = false, utc?: bool = false) → float

Get the difference in years

Changes the value
date.endOf(unit: Unit, params?: mixed) → Date

Modify to end of current given unit. Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->startOf(Unit::Month) ->endOf(Unit::Week, Carbon::FRIDAY);

Changes the value
date.endOfCentury() → Date

Resets the date to end of the century and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfCentury();

Changes the value
date.endOfDay() → Date

Resets the time to 23:59:59.999999 end of day Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfDay();

Changes the value
date.endOfDecade() → Date

Resets the date to end of the decade and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfDecade();

Changes the value
date.endOfHour() → Date

Modify to end of current hour, minutes and seconds become 59 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfHour();

Changes the value
date.endOfMillennium() → Date

Resets the date to end of the millennium and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfMillennium();

Changes the value
date.endOfMillisecond() → Date

Modify to end of current millisecond, microseconds such as 12345 become 123999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->endOfSecond() ->format(‘H:i:s.u’);

Changes the value
date.endOfMinute() → Date

Modify to end of current minute, seconds become 59 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfMinute();

Changes the value
date.endOfMonth() → Date

Resets the date to end of the month and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfMonth();

Changes the value
date.endOfQuarter() → Date

Resets the date to end of the quarter and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfQuarter();

Changes the value
date.endOfSecond() → Date

Modify to end of current second, microseconds become 999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->endOfSecond() ->format(‘H:i:s.u’);

Changes the value
date.endOfWeek(weekEndsAt?: WeekDay) → Date

Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfWeek() . “\n”; echo Carbon::parse(‘2018-07-25 12:45:16’)->locale(‘ar’)->endOfWeek() . “\n”; echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfWeek(Carbon::SATURDAY) . “\n”;

Changes the value
date.endOfYear() → Date

Resets the date to end of the year and time to 23:59:59.999999 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->endOfYear();

date.eq(date: DateTimeInterface) → bool

Determines if the instance is equal to another

Carbon::parse(‘2018-07-25 12:45:16’)->eq(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->eq(Carbon::parse(‘2018-07-25 12:45:16’)); // true Carbon::parse(‘2018-07-25 12:45:16’)->eq(‘2018-07-25 12:45:17’); // false

date.equalTo(date: DateTimeInterface) → bool

Determines if the instance is equal to another

Carbon::parse(‘2018-07-25 12:45:16’)->equalTo(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->equalTo(Carbon::parse(‘2018-07-25 12:45:16’)); // true Carbon::parse(‘2018-07-25 12:45:16’)->equalTo(‘2018-07-25 12:45:17’); // false

date.farthest(date1: mixed, date2: Date) → Date

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

date.firstOfMonth(dayOfWeek?: int) → Date

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.

date.firstOfQuarter(dayOfWeek?: int) → Date

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.

date.firstOfYear(dayOfWeek?: int) → Date

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.

Changes the value
date.floor(precision?: DateInterval = 1) → Date

Round the current instance second with given precision if specified. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorCenturies(precision?: float) → Date

Truncate the current instance century with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorCentury(precision?: float) → Date

Truncate the current instance century with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorDay(precision?: float) → Date

Truncate the current instance day with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorDays(precision?: float) → Date

Truncate the current instance day with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorDecade(precision?: float) → Date

Truncate the current instance decade with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorDecades(precision?: float) → Date

Truncate the current instance decade with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorHour(precision?: float) → Date

Truncate the current instance hour with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorHours(precision?: float) → Date

Truncate the current instance hour with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMicrosecond(precision?: float) → Date

Truncate the current instance microsecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMicroseconds(precision?: float) → Date

Truncate the current instance microsecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMillennia(precision?: float) → Date

Truncate the current instance millennium with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMillennium(precision?: float) → Date

Truncate the current instance millennium with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMillisecond(precision?: float) → Date

Truncate the current instance millisecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMilliseconds(precision?: float) → Date

Truncate the current instance millisecond with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMinute(precision?: float) → Date

Truncate the current instance minute with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMinutes(precision?: float) → Date

Truncate the current instance minute with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMonth(precision?: float) → Date

Truncate the current instance month with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorMonths(precision?: float) → Date

Truncate the current instance month with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorQuarter(precision?: float) → Date

Truncate the current instance quarter with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorQuarters(precision?: float) → Date

Truncate the current instance quarter with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorSecond(precision?: float) → Date

Truncate the current instance second with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorSeconds(precision?: float) → Date

Truncate the current instance second with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorUnit(unit: string, precision?: DateInterval = 1) → Date

Truncate the current instance at the given unit with given precision if specified. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorWeek(weekStartsAt?: WeekDay) → Date

Truncate the current instance week. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorYear(precision?: float) → Date

Truncate the current instance year with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.floorYears(precision?: float) → Date

Truncate the current instance year with given precision. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.format(format: string) → string

Returns the formatted date string on success or FALSE on failure.

date.from(other?: mixed, syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

No description yet.

date.fromNow(syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

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

date.get(name: Unit) → string|int|bool|DateTimeZone

Get a part of the Carbon object.

date.getAltNumber(key: string) → string

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

date.getCalendarFormats(locale?: string) → array

Returns list of calendar formats for ISO formatting.

date.getClock() → WrapperClock

No description yet.

date.getDaysFromStartOfWeek(weekStartsAt?: WeekDay) → int

Return the number of days since the start of the week (using the current locale or the first parameter if explicitly given).

date.getIsoFormats(locale?: string) → array

Returns list of locale formats for ISO formatting.

date.getMicrosecond() → int

No description yet.

date.getOffset()

No description yet.

date.getOffsetString(separator?: string = ":") → string

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”.

date.getPaddedUnit(unit: mixed, length?: mixed = 2, padString?: mixed = "0", padType?: int = 0) → string

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

date.getPreciseTimestamp(precision?: int = 6) → float

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

getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)
getPreciseTimestamp(6) 1532087464437474
getPreciseTimestamp(5) 153208746443747 (1/100000 second precision)
getPreciseTimestamp(4) 15320874644375 (1/10000 second precision)
getPreciseTimestamp(3) 1532087464437 (millisecond precision)
getPreciseTimestamp(2) 153208746444 (1/100 second precision)
getPreciseTimestamp(1) 15320874644 (1/10 second precision)
getPreciseTimestamp(0) 1532087464 (second precision)
getPreciseTimestamp(-1) 153208746 (10 second precision)
getPreciseTimestamp(-2) 15320875 (100 second precision)
date.getSettings() → array

Returns current local settings.

date.getTimestamp()

No description yet.

date.getTimestampMs() → int

Returns the timestamp with millisecond precision.

date.getTimezone() → CarbonTimeZone

Get the TimeZone associated with the Carbon instance (as CarbonTimeZone).

date.getTranslatedDayName(context?: string, keySuffix?: string = "", defaultValue?: string) → string

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

date.getTranslatedMinDayName(context?: string) → string

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

date.getTranslatedMonthName(context?: string, keySuffix?: string = "", defaultValue?: string) → string

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

date.getTranslatedShortDayName(context?: string) → string

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

date.getTranslatedShortMonthName(context?: string) → string

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

date.getTranslationMessage(key: string, locale?: string, default?: string, translator?: TranslatorInterface) → string

Returns raw translation message for a given key.

date.greaterThan(date: DateTimeInterface) → bool

Determines if the instance is greater (after) than another

Carbon::parse(‘2018-07-25 12:45:16’)->greaterThan(‘2018-07-25 12:45:15’); // true Carbon::parse(‘2018-07-25 12:45:16’)->greaterThan(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->greaterThan(‘2018-07-25 12:45:17’); // false

date.greaterThanOrEqualTo(date: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25 12:45:16’)->greaterThanOrEqualTo(‘2018-07-25 12:45:15’); // true Carbon::parse(‘2018-07-25 12:45:16’)->greaterThanOrEqualTo(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->greaterThanOrEqualTo(‘2018-07-25 12:45:17’); // false

date.gt(date: DateTimeInterface) → bool

Determines if the instance is greater (after) than another

Carbon::parse(‘2018-07-25 12:45:16’)->gt(‘2018-07-25 12:45:15’); // true Carbon::parse(‘2018-07-25 12:45:16’)->gt(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->gt(‘2018-07-25 12:45:17’); // false

date.gte(date: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25 12:45:16’)->gte(‘2018-07-25 12:45:15’); // true Carbon::parse(‘2018-07-25 12:45:16’)->gte(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->gte(‘2018-07-25 12:45:17’); // false

date.hasLocalMacro(name: string) → bool

Checks if macro is registered globally or locally.

date.hasLocalTranslator() → bool

Return true if the current instance has its own translator.

Changes the value
date.hour(value: int) → Date

Set current instance hour to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.hourOfCentury(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current century when called with no parameters, change the current hour when called with an integer value

date.hourOfDay(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current day when called with no parameters, change the current hour when called with an integer value

date.hourOfDecade(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current decade when called with no parameters, change the current hour when called with an integer value

date.hourOfMillennium(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current millennium when called with no parameters, change the current hour when called with an integer value

date.hourOfMonth(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current month when called with no parameters, change the current hour when called with an integer value

date.hourOfQuarter(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current quarter when called with no parameters, change the current hour when called with an integer value

date.hourOfWeek(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current week when called with no parameters, change the current hour when called with an integer value

date.hourOfYear(hour?: ?int) → int|static

Return the value of the hour starting from the beginning of the current year when called with no parameters, change the current hour when called with an integer value

date.hours(value: int) → Date

Set current instance hour to the given value.

date.hoursInCentury() → int

Return the number of hours contained in the current century

date.hoursInDay() → int

Return the number of hours contained in the current day

date.hoursInDecade() → int

Return the number of hours contained in the current decade

date.hoursInMillennium() → int

Return the number of hours contained in the current millennium

date.hoursInMonth() → int

Return the number of hours contained in the current month

date.hoursInQuarter() → int

Return the number of hours contained in the current quarter

date.hoursInWeek() → int

Return the number of hours contained in the current week

date.hoursInYear() → int

Return the number of hours contained in the current year

date.hoursUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.is(tester: WeekDay) → bool

Returns true if the current date matches the given string.

var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘2019’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘2018’)); // false var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘2019-06’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘06-02’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘2019-06-02’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘Sunday’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘June’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘12:23’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘12:23:45’)); // true var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘12:23:00’)); // false var_dump(Carbon::parse(‘2019-06-02 12:23:45’)->is(‘12h’)); // true var_dump(Carbon::parse(‘2019-06-02 15:23:45’)->is(‘3pm’)); // true var_dump(Carbon::parse(‘2019-06-02 15:23:45’)->is(‘3am’)); // false

date.isAfter(date: DateTimeInterface) → bool

Determines if the instance is greater (after) than another

Carbon::parse(‘2018-07-25 12:45:16’)->isAfter(‘2018-07-25 12:45:15’); // true Carbon::parse(‘2018-07-25 12:45:16’)->isAfter(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->isAfter(‘2018-07-25 12:45:17’); // false

date.isBefore(date: DateTimeInterface) → bool

Determines if the instance is less (before) than another

Carbon::parse(‘2018-07-25 12:45:16’)->isBefore(‘2018-07-25 12:45:15’); // false Carbon::parse(‘2018-07-25 12:45:16’)->isBefore(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->isBefore(‘2018-07-25 12:45:17’); // true

date.isBetween(date1: DateTimeInterface, date2: DateTimeInterface, equal?: bool = true) → bool

Determines if the instance is between two others

Carbon::parse(‘2018-07-25’)->isBetween(‘2018-07-14’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->isBetween(‘2018-08-01’, ‘2018-08-20’); // false Carbon::parse(‘2018-07-25’)->isBetween(‘2018-07-25’, ‘2018-08-01’); // true Carbon::parse(‘2018-07-25’)->isBetween(‘2018-07-25’, ‘2018-08-01’, false); // false

date.isBirthday(date?: DateTimeInterface) → bool

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

Carbon::now()->subYears(5)->isBirthday(); // true Carbon::now()->subYears(5)->subDay()->isBirthday(); // false Carbon::parse(‘2019-06-05’)->isBirthday(Carbon::parse(‘2001-06-05’)); // true Carbon::parse(‘2019-06-05’)->isBirthday(Carbon::parse(‘2001-06-06’)); // false

date.isCurrentCentury() → bool

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

date.isCurrentDay() → bool

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

date.isCurrentDecade() → bool

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

date.isCurrentHour() → bool

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

date.isCurrentMicro() → bool

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

date.isCurrentMicrosecond() → bool

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

date.isCurrentMillennium() → bool

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

date.isCurrentMilli() → bool

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

date.isCurrentMillisecond() → bool

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

date.isCurrentMinute() → bool

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

date.isCurrentMonth() → bool

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

date.isCurrentQuarter() → bool

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

date.isCurrentSecond() → bool

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

date.isCurrentUnit(unit: string) → bool

Determines if the instance is in the current unit given.

Carbon::now()->isCurrentUnit(‘hour’); // true Carbon::now()->subHours(2)->isCurrentUnit(‘hour’); // false

date.isCurrentWeek() → bool

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

date.isCurrentYear() → bool

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

date.isDST() → bool

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

date.isDayOfWeek(dayOfWeek: int) → bool

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

Carbon::parse(‘2019-07-17’)->isDayOfWeek(Carbon::WEDNESDAY); // true Carbon::parse(‘2019-07-17’)->isDayOfWeek(Carbon::FRIDAY); // false Carbon::parse(‘2019-07-17’)->isDayOfWeek(‘Wednesday’); // true Carbon::parse(‘2019-07-17’)->isDayOfWeek(‘Friday’); // false

date.isEndOfCentury(interval?: Unit) → bool

Determines if the instance is end of century (last day by default but interval can be customized).

date.isEndOfDay(checkMicroseconds?: Unit = false, interval?: Unit) → bool

Check if the instance is end of day.

Carbon::parse(‘2019-02-28 23:59:59.999999’)->isEndOfDay(); // true Carbon::parse(‘2019-02-28 23:59:59.123456’)->isEndOfDay(); // true Carbon::parse(‘2019-02-28 23:59:59’)->isEndOfDay(); // true Carbon::parse(‘2019-02-28 23:59:58.999999’)->isEndOfDay(); // false Carbon::parse(‘2019-02-28 23:59:59.999999’)->isEndOfDay(true); // true Carbon::parse(‘2019-02-28 23:59:59.123456’)->isEndOfDay(true); // false Carbon::parse(‘2019-02-28 23:59:59’)->isEndOfDay(true); // false

date.isEndOfDecade(interval?: Unit) → bool

Determines if the instance is end of decade (last day by default but interval can be customized).

date.isEndOfHour(interval?: Unit) → bool

Determines if the instance is end of hour (last microsecond by default but interval can be customized).

date.isEndOfMillennium(interval?: Unit) → bool

Determines if the instance is end of millennium (last day by default but interval can be customized).

date.isEndOfMillisecond(interval?: Unit) → bool

Determines if the instance is end of millisecond (last microsecond by default but interval can be customized).

date.isEndOfMinute(interval?: Unit) → bool

Determines if the instance is end of minute (last microsecond by default but interval can be customized).

date.isEndOfMonth(interval?: Unit) → bool

Determines if the instance is end of month (last day by default but interval can be customized).

date.isEndOfQuarter(interval?: Unit) → bool

Determines if the instance is end of quarter (last day by default but interval can be customized).

date.isEndOfSecond(interval?: Unit) → bool

Determines if the instance is end of second (last microsecond by default but interval can be customized).

date.isEndOfTime() → bool

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

date.isEndOfUnit(unit: Unit, interval?: Unit, params?: mixed) → bool

Check if the instance is end of a given unit (tolerating a given interval).

// Check if a date-time is the last 15 minutes of the hour it’s in Carbon::parse(‘2019-02-28 20:13:00’)->isEndOfUnit(Unit::Hour, ‘15 minutes’); // false

date.isEndOfWeek(interval?: Unit, weekEndsAt?: WeekDay) → bool

Determines if the instance is end of week (last day by default but interval can be customized).

Carbon::parse(‘2024-08-31’)->endOfWeek()->isEndOfWeek(); // true Carbon::parse(‘2024-08-31’)->isEndOfWeek(); // false

date.isEndOfYear(interval?: Unit) → bool

Determines if the instance is end of year (last day by default but interval can be customized).

date.isFriday() → bool

Checks if the instance day is friday.

date.isFuture() → bool

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

Carbon::now()->addHours(5)->isFuture(); // true Carbon::now()->subHours(5)->isFuture(); // false

date.isLastCentury() → bool

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

date.isLastDay() → bool

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

date.isLastDecade() → bool

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

date.isLastHour() → bool

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

date.isLastMicro() → bool

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

date.isLastMicrosecond() → bool

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

date.isLastMillennium() → bool

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

date.isLastMilli() → bool

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

date.isLastMillisecond() → bool

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

date.isLastMinute() → bool

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

date.isLastMonth() → bool

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

date.isLastOfMonth() → bool

Check if today is the last day of the Month

Carbon::parse(‘2019-02-28’)->isLastOfMonth(); // true Carbon::parse(‘2019-03-28’)->isLastOfMonth(); // false Carbon::parse(‘2019-03-30’)->isLastOfMonth(); // false Carbon::parse(‘2019-03-31’)->isLastOfMonth(); // true Carbon::parse(‘2019-04-30’)->isLastOfMonth(); // true

date.isLastQuarter() → bool

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

date.isLastSecond() → bool

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

date.isLastWeek() → bool

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

date.isLastYear() → bool

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

date.isLeapYear() → bool

Determines if the instance is a leap year.

Carbon::parse(‘2020-01-01’)->isLeapYear(); // true Carbon::parse(‘2019-01-01’)->isLeapYear(); // false

date.isLocal() → bool

Check if the current instance has non-UTC timezone.

date.isLongIsoYear() → bool

Determines if the instance is a long year (using ISO 8601 year).

Carbon::parse(‘2015-01-01’)->isLongIsoYear(); // true Carbon::parse(‘2016-01-01’)->isLongIsoYear(); // true Carbon::parse(‘2016-01-03’)->isLongIsoYear(); // false Carbon::parse(‘2019-12-29’)->isLongIsoYear(); // false Carbon::parse(‘2019-12-30’)->isLongIsoYear(); // true

date.isLongYear() → bool

Determines if the instance is a long year (using calendar year).

⚠️ This method completely ignores month and day to use the numeric year number, it’s not correct if the exact date matters. For instance as 2019-12-30 is already in the first week of the 2020 year, if you want to know from this date if ISO week year 2020 is a long year, use isLongIsoYear instead.

Carbon::create(2015)->isLongYear(); // true Carbon::create(2016)->isLongYear(); // false

date.isMidday() → bool

Check if the instance is midday.

Carbon::parse(‘2019-02-28 11:59:59.999999’)->isMidday(); // false Carbon::parse(‘2019-02-28 12:00:00’)->isMidday(); // true Carbon::parse(‘2019-02-28 12:00:00.999999’)->isMidday(); // true Carbon::parse(‘2019-02-28 12:00:01’)->isMidday(); // false

date.isMidnight() → bool

Check if the instance is start of day / midnight.

Carbon::parse(‘2019-02-28 00:00:00’)->isMidnight(); // true Carbon::parse(‘2019-02-28 00:00:00.999999’)->isMidnight(); // true Carbon::parse(‘2019-02-28 00:00:01’)->isMidnight(); // false

date.isMonday() → bool

Checks if the instance day is monday.

date.isNextCentury() → bool

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

date.isNextDay() → bool

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

date.isNextDecade() → bool

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

date.isNextHour() → bool

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

date.isNextMicro() → bool

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

date.isNextMicrosecond() → bool

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

date.isNextMillennium() → bool

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

date.isNextMilli() → bool

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

date.isNextMillisecond() → bool

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

date.isNextMinute() → bool

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

date.isNextMonth() → bool

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

date.isNextQuarter() → bool

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

date.isNextSecond() → bool

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

date.isNextWeek() → bool

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

date.isNextYear() → bool

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

date.isNowOrFuture() → bool

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

Carbon::now()->isNowOrFuture(); // true Carbon::now()->addHours(5)->isNowOrFuture(); // true Carbon::now()->subHours(5)->isNowOrFuture(); // false

date.isNowOrPast() → bool

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

Carbon::now()->isNowOrPast(); // true Carbon::now()->subHours(5)->isNowOrPast(); // true Carbon::now()->addHours(5)->isNowOrPast(); // false

date.isPast() → bool

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

Carbon::now()->subHours(5)->isPast(); // true Carbon::now()->addHours(5)->isPast(); // false

date.isSameAs(format: string, date: DateTimeInterface) → bool

Compares the formatted values of the two dates.

Carbon::parse(‘2019-06-13’)->isSameAs(‘Y-d’, Carbon::parse(‘2019-12-13’)); // true Carbon::parse(‘2019-06-13’)->isSameAs(‘Y-d’, Carbon::parse(‘2019-06-14’)); // false

date.isSameCentury(date: DateTimeInterface|string) → bool

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

date.isSameDay(date: DateTimeInterface|string) → bool

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

date.isSameDecade(date: DateTimeInterface|string) → bool

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

date.isSameHour(date: DateTimeInterface|string) → bool

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

date.isSameMicro(date: DateTimeInterface|string) → bool

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

date.isSameMicrosecond(date: DateTimeInterface|string) → bool

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

date.isSameMillennium(date: DateTimeInterface|string) → bool

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

date.isSameMilli(date: DateTimeInterface|string) → bool

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

date.isSameMillisecond(date: DateTimeInterface|string) → bool

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

date.isSameMinute(date: DateTimeInterface|string) → bool

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

date.isSameMonth(date: DateTimeInterface, ofSameYear?: bool = true) → bool

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

Carbon::parse(‘2019-01-12’)->isSameMonth(Carbon::parse(‘2019-01-01’)); // true Carbon::parse(‘2019-01-12’)->isSameMonth(Carbon::parse(‘2019-02-01’)); // false Carbon::parse(‘2019-01-12’)->isSameMonth(Carbon::parse(‘2018-01-01’)); // false Carbon::parse(‘2019-01-12’)->isSameMonth(Carbon::parse(‘2018-01-01’), false); // true

date.isSameQuarter(date: DateTimeInterface, ofSameYear?: bool = true) → bool

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

Carbon::parse(‘2019-01-12’)->isSameQuarter(Carbon::parse(‘2019-03-01’)); // true Carbon::parse(‘2019-01-12’)->isSameQuarter(Carbon::parse(‘2019-04-01’)); // false Carbon::parse(‘2019-01-12’)->isSameQuarter(Carbon::parse(‘2018-03-01’)); // false Carbon::parse(‘2019-01-12’)->isSameQuarter(Carbon::parse(‘2018-03-01’), false); // true

date.isSameSecond(date: DateTimeInterface|string) → bool

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

date.isSameUnit(unit: string, date: DateTimeInterface) → bool

Determines if the instance is in the current unit given.

Carbon::parse(‘2019-01-13’)->isSameUnit(‘year’, Carbon::parse(‘2019-12-25’)); // true Carbon::parse(‘2018-12-13’)->isSameUnit(‘year’, Carbon::parse(‘2019-12-25’)); // false

date.isSameWeek(date: DateTimeInterface|string) → bool

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

date.isSameYear(date: DateTimeInterface|string) → bool

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

date.isSaturday() → bool

Checks if the instance day is saturday.

date.isStartOfCentury(interval?: Unit) → bool

Determines if the instance is start of century (first day by default but interval can be customized).

date.isStartOfDay(checkMicroseconds?: Unit = false, interval?: Unit) → bool

Check if the instance is start of day / midnight.

Carbon::parse(‘2019-02-28 00:00:00’)->isStartOfDay(); // true Carbon::parse(‘2019-02-28 00:00:00.999999’)->isStartOfDay(); // true Carbon::parse(‘2019-02-28 00:00:01’)->isStartOfDay(); // false Carbon::parse(‘2019-02-28 00:00:00.000000’)->isStartOfDay(true); // true Carbon::parse(‘2019-02-28 00:00:00.000012’)->isStartOfDay(true); // false

date.isStartOfDecade(interval?: Unit) → bool

Determines if the instance is start of decade (first day by default but interval can be customized).

date.isStartOfHour(interval?: Unit) → bool

Determines if the instance is start of hour (first microsecond by default but interval can be customized).

date.isStartOfMillennium(interval?: Unit) → bool

Determines if the instance is start of millennium (first day by default but interval can be customized).

date.isStartOfMillisecond(interval?: Unit) → bool

Determines if the instance is start of millisecond (first microsecond by default but interval can be customized).

date.isStartOfMinute(interval?: Unit) → bool

Determines if the instance is start of minute (first microsecond by default but interval can be customized).

date.isStartOfMonth(interval?: Unit) → bool

Determines if the instance is start of month (first day by default but interval can be customized).

date.isStartOfQuarter(interval?: Unit) → bool

Determines if the instance is start of quarter (first day by default but interval can be customized).

date.isStartOfSecond(interval?: Unit) → bool

Determines if the instance is start of second (first microsecond by default but interval can be customized).

date.isStartOfTime() → bool

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

date.isStartOfUnit(unit: Unit, interval?: Unit, params?: mixed) → bool

Check if the instance is start of a given unit (tolerating a given interval).

// Check if a date-time is the first 15 minutes of the hour it’s in Carbon::parse(‘2019-02-28 20:13:00’)->isStartOfUnit(Unit::Hour, ‘15 minutes’); // true

date.isStartOfWeek(interval?: Unit, weekStartsAt?: WeekDay) → bool

Determines if the instance is start of week (first day by default but interval can be customized).

Carbon::parse(‘2024-08-31’)->startOfWeek()->isStartOfWeek(); // true Carbon::parse(‘2024-08-31’)->isStartOfWeek(); // false

date.isStartOfYear(interval?: Unit) → bool

Determines if the instance is start of year (first day by default but interval can be customized).

date.isSunday() → bool

Checks if the instance day is sunday.

date.isThursday() → bool

Checks if the instance day is thursday.

date.isToday() → bool

Determines if the instance is today.

Carbon::today()->isToday(); // true Carbon::tomorrow()->isToday(); // false

date.isTomorrow() → bool

Determines if the instance is tomorrow.

Carbon::tomorrow()->isTomorrow(); // true Carbon::yesterday()->isTomorrow(); // false

date.isTuesday() → bool

Checks if the instance day is tuesday.

date.isUtc() → bool

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

date.isValid() → bool

Check if the current instance is a valid date.

date.isWednesday() → bool

Checks if the instance day is wednesday.

date.isWeekday() → bool

Determines if the instance is a weekday.

Carbon::parse(‘2019-07-14’)->isWeekday(); // false Carbon::parse(‘2019-07-15’)->isWeekday(); // true

date.isWeekend() → bool

Determines if the instance is a weekend day.

Carbon::parse(‘2019-07-14’)->isWeekend(); // true Carbon::parse(‘2019-07-15’)->isWeekend(); // false

date.isYesterday() → bool

Determines if the instance is yesterday.

Carbon::yesterday()->isYesterday(); // true Carbon::tomorrow()->isYesterday(); // false

date.isoFormat(format: string, originalFormat?: string) → string

Format in the current language using ISO replacement patterns.

date.isoWeek(week?: mixed, dayOfWeek?: mixed, dayOfYear?: int) → Date

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.

date.isoWeekYear(year?: mixed, dayOfWeek?: mixed, dayOfYear?: int) → Date

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.

date.isoWeekday(value?: WeekDay) → Date

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

date.isoWeeksInYear(dayOfWeek?: mixed, dayOfYear?: int) → int

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.

date.lastOfMonth(dayOfWeek?: int) → Date

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.

date.lastOfQuarter(dayOfWeek?: int) → Date

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.

date.lastOfYear(dayOfWeek?: int) → Date

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.

date.lessThan(date: DateTimeInterface) → bool

Determines if the instance is less (before) than another

Carbon::parse(‘2018-07-25 12:45:16’)->lessThan(‘2018-07-25 12:45:15’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lessThan(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lessThan(‘2018-07-25 12:45:17’); // true

date.lessThanOrEqualTo(date: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25 12:45:16’)->lessThanOrEqualTo(‘2018-07-25 12:45:15’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lessThanOrEqualTo(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->lessThanOrEqualTo(‘2018-07-25 12:45:17’); // true

date.locale(locale?: string, fallbackLocales?: string) → Date

Get/set the locale for the current instance.

date.longAbsoluteDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.longRelativeDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.longRelativeToNowDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.longRelativeToOtherDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.lt(date: DateTimeInterface) → bool

Determines if the instance is less (before) than another

Carbon::parse(‘2018-07-25 12:45:16’)->lt(‘2018-07-25 12:45:15’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lt(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lt(‘2018-07-25 12:45:17’); // true

date.lte(date: DateTimeInterface) → bool

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

Carbon::parse(‘2018-07-25 12:45:16’)->lte(‘2018-07-25 12:45:15’); // false Carbon::parse(‘2018-07-25 12:45:16’)->lte(‘2018-07-25 12:45:16’); // true Carbon::parse(‘2018-07-25 12:45:16’)->lte(‘2018-07-25 12:45:17’); // true

date.max(date?: Date) → Date

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

date.maximum(date?: Date) → Date

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

date.meridiem(isLower?: bool = false) → string

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

date.micro(value: int) → Date

Set current instance microsecond to the given value.

date.micros(value: int) → Date

Set current instance microsecond to the given value.

date.microsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

Changes the value
date.microsecond(value: int) → Date

Set current instance microsecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.microsecondOfCentury(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current century when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfDay(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current day when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfDecade(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current decade when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfHour(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current hour when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfMillennium(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current millennium when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfMillisecond(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current millisecond when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfMinute(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current minute when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfMonth(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current month when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfQuarter(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current quarter when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfSecond(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current second when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfWeek(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current week when called with no parameters, change the current microsecond when called with an integer value

date.microsecondOfYear(microsecond?: ?int) → int|static

Return the value of the microsecond starting from the beginning of the current year when called with no parameters, change the current microsecond when called with an integer value

date.microseconds(value: int) → Date

Set current instance microsecond to the given value.

date.microsecondsInCentury() → int

Return the number of microseconds contained in the current century

date.microsecondsInDay() → int

Return the number of microseconds contained in the current day

date.microsecondsInDecade() → int

Return the number of microseconds contained in the current decade

date.microsecondsInHour() → int

Return the number of microseconds contained in the current hour

date.microsecondsInMillennium() → int

Return the number of microseconds contained in the current millennium

date.microsecondsInMillisecond() → int

Return the number of microseconds contained in the current millisecond

date.microsecondsInMinute() → int

Return the number of microseconds contained in the current minute

date.microsecondsInMonth() → int

Return the number of microseconds contained in the current month

date.microsecondsInQuarter() → int

Return the number of microseconds contained in the current quarter

date.microsecondsInSecond() → int

Return the number of microseconds contained in the current second

date.microsecondsInWeek() → int

Return the number of microseconds contained in the current week

date.microsecondsInYear() → int

Return the number of microseconds contained in the current year

date.microsecondsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.midDay() → Date

Modify to midday, default to self::$midDayAt

date.millenniaUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.milli(value: int) → Date

Set current instance millisecond to the given value.

date.millis(value: int) → Date

Set current instance millisecond to the given value.

date.millisUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

Changes the value
date.millisecond(value: int) → Date

Set current instance millisecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.millisecondOfCentury(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current century when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfDay(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current day when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfDecade(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current decade when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfHour(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current hour when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfMillennium(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current millennium when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfMinute(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current minute when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfMonth(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current month when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfQuarter(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current quarter when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfSecond(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current second when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfWeek(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current week when called with no parameters, change the current millisecond when called with an integer value

date.millisecondOfYear(millisecond?: ?int) → int|static

Return the value of the millisecond starting from the beginning of the current year when called with no parameters, change the current millisecond when called with an integer value

date.milliseconds(value: int) → Date

Set current instance millisecond to the given value.

date.millisecondsInCentury() → int

Return the number of milliseconds contained in the current century

date.millisecondsInDay() → int

Return the number of milliseconds contained in the current day

date.millisecondsInDecade() → int

Return the number of milliseconds contained in the current decade

date.millisecondsInHour() → int

Return the number of milliseconds contained in the current hour

date.millisecondsInMillennium() → int

Return the number of milliseconds contained in the current millennium

date.millisecondsInMinute() → int

Return the number of milliseconds contained in the current minute

date.millisecondsInMonth() → int

Return the number of milliseconds contained in the current month

date.millisecondsInQuarter() → int

Return the number of milliseconds contained in the current quarter

date.millisecondsInSecond() → int

Return the number of milliseconds contained in the current second

date.millisecondsInWeek() → int

Return the number of milliseconds contained in the current week

date.millisecondsInYear() → int

Return the number of milliseconds contained in the current year

date.millisecondsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.min(date?: Date) → Date

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

date.minimum(date?: Date) → Date

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

Changes the value
date.minute(value: int) → Date

Set current instance minute to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.minuteOfCentury(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current century when called with no parameters, change the current minute when called with an integer value

date.minuteOfDay(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current day when called with no parameters, change the current minute when called with an integer value

date.minuteOfDecade(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current decade when called with no parameters, change the current minute when called with an integer value

date.minuteOfHour(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current hour when called with no parameters, change the current minute when called with an integer value

date.minuteOfMillennium(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current millennium when called with no parameters, change the current minute when called with an integer value

date.minuteOfMonth(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current month when called with no parameters, change the current minute when called with an integer value

date.minuteOfQuarter(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current quarter when called with no parameters, change the current minute when called with an integer value

date.minuteOfWeek(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current week when called with no parameters, change the current minute when called with an integer value

date.minuteOfYear(minute?: ?int) → int|static

Return the value of the minute starting from the beginning of the current year when called with no parameters, change the current minute when called with an integer value

date.minutes(value: int) → Date

Set current instance minute to the given value.

date.minutesInCentury() → int

Return the number of minutes contained in the current century

date.minutesInDay() → int

Return the number of minutes contained in the current day

date.minutesInDecade() → int

Return the number of minutes contained in the current decade

date.minutesInHour() → int

Return the number of minutes contained in the current hour

date.minutesInMillennium() → int

Return the number of minutes contained in the current millennium

date.minutesInMonth() → int

Return the number of minutes contained in the current month

date.minutesInQuarter() → int

Return the number of minutes contained in the current quarter

date.minutesInWeek() → int

Return the number of minutes contained in the current week

date.minutesInYear() → int

Return the number of minutes contained in the current year

date.minutesUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

Changes the value
date.modify(modify: mixed) → Date

Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.month(value: Month|int) → Date

Set current instance month to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.monthOfCentury(month?: ?int) → int|static

Return the value of the month starting from the beginning of the current century when called with no parameters, change the current month when called with an integer value

date.monthOfDecade(month?: ?int) → int|static

Return the value of the month starting from the beginning of the current decade when called with no parameters, change the current month when called with an integer value

date.monthOfMillennium(month?: ?int) → int|static

Return the value of the month starting from the beginning of the current millennium when called with no parameters, change the current month when called with an integer value

date.monthOfQuarter(month?: ?int) → int|static

Return the value of the month starting from the beginning of the current quarter when called with no parameters, change the current month when called with an integer value

date.monthOfYear(month?: ?int) → int|static

Return the value of the month starting from the beginning of the current year when called with no parameters, change the current month when called with an integer value

date.months(value: Month|int) → Date

Set current instance month to the given value.

date.monthsInCentury() → int

Return the number of months contained in the current century

date.monthsInDecade() → int

Return the number of months contained in the current decade

date.monthsInMillennium() → int

Return the number of months contained in the current millennium

date.monthsInQuarter() → int

Return the number of months contained in the current quarter

date.monthsInYear() → int

Return the number of months contained in the current year

date.monthsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.ne(date: DateTimeInterface) → bool

Determines if the instance is not equal to another

Carbon::parse(‘2018-07-25 12:45:16’)->ne(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->ne(Carbon::parse(‘2018-07-25 12:45:16’)); // false Carbon::parse(‘2018-07-25 12:45:16’)->ne(‘2018-07-25 12:45:17’); // true

Changes the value
date.next(modifier?: string) → Date

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. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.nextWeekday() → Date

Go forward to the next weekday. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.nextWeekendDay() → Date

Go forward to the next weekend day. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.notEqualTo(date: DateTimeInterface) → bool

Determines if the instance is not equal to another

Carbon::parse(‘2018-07-25 12:45:16’)->notEqualTo(‘2018-07-25 12:45:16’); // false Carbon::parse(‘2018-07-25 12:45:16’)->notEqualTo(Carbon::parse(‘2018-07-25 12:45:16’)); // false Carbon::parse(‘2018-07-25 12:45:16’)->notEqualTo(‘2018-07-25 12:45:17’); // true

date.nowWithSameTz() → Date

Returns a present instance in the same timezone.

date.nthOfMonth(nth: mixed, dayOfWeek: int)

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.

date.nthOfQuarter(nth: mixed, dayOfWeek: int)

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.

date.nthOfYear(nth: mixed, dayOfWeek: int)

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.

date.ordinal(key: string, period?: string) → string

Return a property with its ordinal.

Changes the value
date.previous(modifier?: string) → Date

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. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.previousWeekday() → Date

Go backward to the previous weekday. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.previousWeekendDay() → Date

Go backward to the previous weekend day. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.quarterOfCentury(quarter?: ?int) → int|static

Return the value of the quarter starting from the beginning of the current century when called with no parameters, change the current quarter when called with an integer value

date.quarterOfDecade(quarter?: ?int) → int|static

Return the value of the quarter starting from the beginning of the current decade when called with no parameters, change the current quarter when called with an integer value

date.quarterOfMillennium(quarter?: ?int) → int|static

Return the value of the quarter starting from the beginning of the current millennium when called with no parameters, change the current quarter when called with an integer value

date.quarterOfYear(quarter?: ?int) → int|static

Return the value of the quarter starting from the beginning of the current year when called with no parameters, change the current quarter when called with an integer value

date.quartersInCentury() → int

Return the number of quarters contained in the current century

date.quartersInDecade() → int

Return the number of quarters contained in the current decade

date.quartersInMillennium() → int

Return the number of quarters contained in the current millennium

date.quartersInYear() → int

Return the number of quarters contained in the current year

date.quartersUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.range(end?: mixed, interval?: mixed, unit?: string) → CarbonPeriod

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

date.rawAdd(interval: DateInterval) → Date

Call native PHP DateTime/DateTimeImmutable add() method.

date.rawFormat(format: string) → string

No description yet.

date.rawSub(interval: DateInterval) → Date

Call native PHP DateTime/DateTimeImmutable sub() method.

Changes the value
date.round(precision?: DateInterval = 1, function?: callable = "round") → Date

Round the current instance second with given precision if specified. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundCenturies(precision?: float, function?: string) → Date

Round the current instance century with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundCentury(precision?: float, function?: string) → Date

Round the current instance century with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundDay(precision?: float, function?: string) → Date

Round the current instance day with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundDays(precision?: float, function?: string) → Date

Round the current instance day with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundDecade(precision?: float, function?: string) → Date

Round the current instance decade with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundDecades(precision?: float, function?: string) → Date

Round the current instance decade with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundHour(precision?: float, function?: string) → Date

Round the current instance hour with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundHours(precision?: float, function?: string) → Date

Round the current instance hour with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMicrosecond(precision?: float, function?: string) → Date

Round the current instance microsecond with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMicroseconds(precision?: float, function?: string) → Date

Round the current instance microsecond with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMillennia(precision?: float, function?: string) → Date

Round the current instance millennium with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMillennium(precision?: float, function?: string) → Date

Round the current instance millennium with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMillisecond(precision?: float, function?: string) → Date

Round the current instance millisecond with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMilliseconds(precision?: float, function?: string) → Date

Round the current instance millisecond with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMinute(precision?: float, function?: string) → Date

Round the current instance minute with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMinutes(precision?: float, function?: string) → Date

Round the current instance minute with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMonth(precision?: float, function?: string) → Date

Round the current instance month with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundMonths(precision?: float, function?: string) → Date

Round the current instance month with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundQuarter(precision?: float, function?: string) → Date

Round the current instance quarter with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundQuarters(precision?: float, function?: string) → Date

Round the current instance quarter with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundSecond(precision?: float, function?: string) → Date

Round the current instance second with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundSeconds(precision?: float, function?: string) → Date

Round the current instance second with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundUnit(unit: string, precision?: DateInterval = 1, function?: callable = "round") → Date

Round the current instance at the given unit with given precision if specified and the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundWeek(weekStartsAt?: WeekDay) → Date

Round the current instance week. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundYear(precision?: float, function?: string) → Date

Round the current instance year with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.roundYears(precision?: float, function?: string) → Date

Round the current instance year with given precision using the given function. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.second(value: int) → Date

Set current instance second to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.secondOfCentury(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current century when called with no parameters, change the current second when called with an integer value

date.secondOfDay(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current day when called with no parameters, change the current second when called with an integer value

date.secondOfDecade(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current decade when called with no parameters, change the current second when called with an integer value

date.secondOfHour(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current hour when called with no parameters, change the current second when called with an integer value

date.secondOfMillennium(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current millennium when called with no parameters, change the current second when called with an integer value

date.secondOfMinute(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current minute when called with no parameters, change the current second when called with an integer value

date.secondOfMonth(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current month when called with no parameters, change the current second when called with an integer value

date.secondOfQuarter(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current quarter when called with no parameters, change the current second when called with an integer value

date.secondOfWeek(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current week when called with no parameters, change the current second when called with an integer value

date.secondOfYear(second?: ?int) → int|static

Return the value of the second starting from the beginning of the current year when called with no parameters, change the current second when called with an integer value

date.seconds(value: int) → Date

Set current instance second to the given value.

date.secondsInCentury() → int

Return the number of seconds contained in the current century

date.secondsInDay() → int

Return the number of seconds contained in the current day

date.secondsInDecade() → int

Return the number of seconds contained in the current decade

date.secondsInHour() → int

Return the number of seconds contained in the current hour

date.secondsInMillennium() → int

Return the number of seconds contained in the current millennium

date.secondsInMinute() → int

Return the number of seconds contained in the current minute

date.secondsInMonth() → int

Return the number of seconds contained in the current month

date.secondsInQuarter() → int

Return the number of seconds contained in the current quarter

date.secondsInWeek() → int

Return the number of seconds contained in the current week

date.secondsInYear() → int

Return the number of seconds contained in the current year

date.secondsSinceMidnight() → float

The number of seconds since midnight.

date.secondsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

date.secondsUntilEndOfDay() → float

The number of seconds until 23:59:59.

date.serialize() → string

Return a serialized string of the instance.

Changes the value
date.set(name: Unit, value?: DateTimeZone) → Date

Set a part of the Carbon object. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDate(year: int, month: int, day: int) → Date

Set the date with gregorian year, month and day numbers. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDateFrom(date: DateTimeInterface) → Date

Set the year, month, and date for this instance to that of the passed instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDateTime(year: int, month: int, day: int, hour: int, minute: int, second?: int = 0, microseconds?: int = 0) → Date

Set the date and time all together. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDateTimeFrom(date: DateTimeInterface) → Date

Set the date and time for this instance to that of the passed instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDay(value: int) → Date

Set current instance day to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDays(value: int) → Date

Set current instance day to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setDaysFromStartOfWeek(numberOfDays: int, weekStartsAt?: WeekDay) → Date

Set the day (keeping the current time) to the start of the week + the number of days passed as the first parameter. First day of week is driven by the locale unless explicitly set with the second parameter. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setHour(value: int) → Date

Set current instance hour to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setHours(value: int) → Date

Set current instance hour to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setISODate(year: int, week: int, day?: int = 1) → Date

Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMicro(value: int) → Date

Set current instance microsecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMicros(value: int) → Date

Set current instance microsecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMicrosecond(microsecond: int) → Date

Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMicroseconds(value: int) → Date

Set current instance microsecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMilli(value: int) → Date

Set current instance millisecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMillis(value: int) → Date

Set current instance millisecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMillisecond(value: int) → Date

Set current instance millisecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMilliseconds(value: int) → Date

Set current instance millisecond to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMinute(value: int) → Date

Set current instance minute to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMinutes(value: int) → Date

Set current instance minute to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMonth(value: Month|int) → Date

Set current instance month to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setMonths(value: Month|int) → Date

Set current instance month to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setSecond(value: int) → Date

Set current instance second to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setSeconds(value: int) → Date

Set current instance second to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setTime(hour: int, minute: int, second?: int = 0, microseconds?: int = 0) → Date

Resets the current time of the DateTime object to a different time. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setTimeFrom(date: DateTimeInterface) → Date

Set the hour, minute, second and microseconds for this instance to that of the passed instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setTimeFromTimeString(time: string) → Date

Set the time by time string. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setTimestamp(timestamp: string) → Date

Set the instance’s timestamp.

Timestamp input can be given as int, float or a string containing one or more numbers. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setTimezone(timeZone: DateTimeZone) → Date

Set the instance’s timezone from a string or object. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setUnit(unit: string, value?: Month) → Date

Set specified unit to new given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setUnitNoOverflow(valueUnit: string, value: int, overflowUnit: string) → Date

Set any unit to a new value without overflowing current other unit given. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setYear(value: int) → Date

Set current instance year to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.setYears(value: int) → Date

Set current instance year to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.shiftTimezone(value: DateTimeZone) → Date

Set the instance’s timezone from a string or object and add/subtract the offset difference. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.shortAbsoluteDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.shortRelativeDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.shortRelativeToNowDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.shortRelativeToOtherDiffForHumans(other?: DateTimeInterface, parts?: int) → string

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

date.since(other?: mixed, syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: mixed)

No description yet.

Changes the value
date.startOf(unit: Unit, params?: mixed) → Date

Modify to start of current given unit. Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->startOf(Unit::Month) ->endOf(Unit::Week, Carbon::FRIDAY);

Changes the value
date.startOfCentury() → Date

Resets the date to the first day of the century and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfCentury();

Changes the value
date.startOfDay() → Date

Resets the time to 00:00:00 start of day Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfDay();

Changes the value
date.startOfDecade() → Date

Resets the date to the first day of the decade and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfDecade();

Changes the value
date.startOfHour() → Date

Modify to start of current hour, minutes and seconds become 0 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfHour();

Changes the value
date.startOfMillennium() → Date

Resets the date to the first day of the millennium and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfMillennium();

Changes the value
date.startOfMillisecond() → Date

Modify to start of current millisecond, microseconds such as 12345 become 123000 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->startOfSecond() ->format(‘H:i:s.u’);

Changes the value
date.startOfMinute() → Date

Modify to start of current minute, seconds become 0 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfMinute();

Changes the value
date.startOfMonth() → Date

Resets the date to the first day of the month and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfMonth();

Changes the value
date.startOfQuarter() → Date

Resets the date to the first day of the quarter and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfQuarter();

Changes the value
date.startOfSecond() → Date

Modify to start of current second, microseconds become 0 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16.334455’) ->startOfSecond() ->format(‘H:i:s.u’);

Changes the value
date.startOfWeek(weekStartsAt?: WeekDay) → Date

Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfWeek() . “\n”; echo Carbon::parse(‘2018-07-25 12:45:16’)->locale(‘ar’)->startOfWeek() . “\n”; echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfWeek(Carbon::SUNDAY) . “\n”;

Changes the value
date.startOfYear() → Date

Resets the date to the first day of the year and the time to 00:00:00 Changes this date in place and returns it. Use date.copy() first to keep the original.

echo Carbon::parse(‘2018-07-25 12:45:16’)->startOfYear();

Changes the value
date.sub(unit: mixed, value?: mixed = 1, overflow?: bool) → Date

Subtract given units or interval to the current instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

$date->sub('hour', 3)
$date->sub(15, 'days')
$date->sub(CarbonInterval::days(4))
Changes the value
date.subCenturies(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturiesNoOverflow(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturiesWithNoOverflow(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturiesWithOverflow(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturiesWithoutOverflow(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCentury() → Date

Sub one century to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturyNoOverflow() → Date

Sub one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturyWithNoOverflow() → Date

Sub one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturyWithOverflow() → Date

Sub one century to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subCenturyWithoutOverflow() → Date

Sub one century to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDay() → Date

Sub one day to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDays(value?: int|float) → Date

Sub days (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecade() → Date

Sub one decade to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadeNoOverflow() → Date

Sub one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadeWithNoOverflow() → Date

Sub one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadeWithOverflow() → Date

Sub one decade to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadeWithoutOverflow() → Date

Sub one decade to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecades(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadesNoOverflow(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadesWithNoOverflow(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadesWithOverflow(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subDecadesWithoutOverflow(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subHour() → Date

Sub one hour to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subHours(value?: int|float) → Date

Sub hours (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMicro() → Date

Sub one microsecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMicros(value?: int|float) → Date

Sub microseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMicrosecond() → Date

Sub one microsecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMicroseconds(value?: int|float) → Date

Sub microseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillennia(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniaNoOverflow(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniaWithNoOverflow(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniaWithOverflow(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniaWithoutOverflow(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillennium() → Date

Sub one millennium to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniumNoOverflow() → Date

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniumWithNoOverflow() → Date

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniumWithOverflow() → Date

Sub one millennium to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillenniumWithoutOverflow() → Date

Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMilli() → Date

Sub one millisecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillis(value?: int|float) → Date

Sub milliseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMillisecond() → Date

Sub one millisecond to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMilliseconds(value?: int|float) → Date

Sub milliseconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMinute() → Date

Sub one minute to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMinutes(value?: int|float) → Date

Sub minutes (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonth() → Date

Sub one month to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthNoOverflow() → Date

Sub one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthWithNoOverflow() → Date

Sub one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthWithOverflow() → Date

Sub one month to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthWithoutOverflow() → Date

Sub one month to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonths(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthsNoOverflow(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthsWithNoOverflow(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthsWithOverflow(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subMonthsWithoutOverflow(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarter() → Date

Sub one quarter to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarterNoOverflow() → Date

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarterWithNoOverflow() → Date

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarterWithOverflow() → Date

Sub one quarter to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarterWithoutOverflow() → Date

Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuarters(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuartersNoOverflow(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuartersWithNoOverflow(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuartersWithOverflow(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subQuartersWithoutOverflow(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subRealUnit(unit: mixed, value?: int = 1) → Date

Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subSecond() → Date

Sub one second to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subSeconds(value?: int|float) → Date

Sub seconds (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCCenturies(value?: int|float) → Date

Sub centuries (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCCentury() → Date

Sub one century to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCDay() → Date

Sub one day to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCDays(value?: int|float) → Date

Sub days (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCDecade() → Date

Sub one decade to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCDecades(value?: int|float) → Date

Sub decades (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCHour() → Date

Sub one hour to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCHours(value?: int|float) → Date

Sub hours (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMicro() → Date

Sub one microsecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMicros(value?: int|float) → Date

Sub microseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMicrosecond() → Date

Sub one microsecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMicroseconds(value?: int|float) → Date

Sub microseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMillennia(value?: int|float) → Date

Sub millennia (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMillennium() → Date

Sub one millennium to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMilli() → Date

Sub one millisecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMillis(value?: int|float) → Date

Sub milliseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMillisecond() → Date

Sub one millisecond to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMilliseconds(value?: int|float) → Date

Sub milliseconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMinute() → Date

Sub one minute to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMinutes(value?: int|float) → Date

Sub minutes (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMonth() → Date

Sub one month to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCMonths(value?: int|float) → Date

Sub months (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCQuarter() → Date

Sub one quarter to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCQuarters(value?: int|float) → Date

Sub quarters (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCSecond() → Date

Sub one second to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCSeconds(value?: int|float) → Date

Sub seconds (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCUnit(unit: mixed, value?: int = 1) → Date

Subtract seconds to the instance using timestamp. Positive $value travels into the past while negative $value travels forward. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCWeek() → Date

Sub one week to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCWeeks(value?: int|float) → Date

Sub weeks (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCYear() → Date

Sub one year to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUTCYears(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using timestamp). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUnit(unit: Unit, value?: mixed = 1, overflow?: bool) → Date

Subtract given units to the current instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subUnitNoOverflow(valueUnit: string, value: int, overflowUnit: string) → Date

Subtract any unit to a new value without overflowing current other unit given. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subWeek() → Date

Sub one week to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subWeekday() → Date

Sub one weekday to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subWeekdays(value?: int|float) → Date

Sub weekdays (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subWeeks(value?: int|float) → Date

Sub weeks (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYear() → Date

Sub one year to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearNoOverflow() → Date

Sub one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearWithNoOverflow() → Date

Sub one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearWithOverflow() → Date

Sub one year to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearWithoutOverflow() → Date

Sub one year to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYears(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using date interval). Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearsNoOverflow(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearsWithNoOverflow(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearsWithOverflow(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subYearsWithoutOverflow(value?: int|float) → Date

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. Changes this date in place and returns it. Use date.copy() first to keep the original.

Changes the value
date.subtract(unit: mixed, value?: mixed = 1, overflow?: bool) → Date

Subtract given units or interval to the current instance. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.timespan(other?: mixed, timezone?: mixed) → string

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

date.timestamp(timestamp: string) → Date

Set the instance’s timestamp.

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

date.timezone(value: DateTimeZone) → Date

No description yet.

date.to(other?: mixed, syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

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

date.toArray() → array

Get default array representation.

var_dump(Carbon::now()->toArray());

date.toAtomString() → string

Format the instance as ATOM

echo Carbon::now()->toAtomString();

date.toCookieString() → string

Format the instance as COOKIE

echo Carbon::now()->toCookieString();

date.toDate() → DateTime

No description yet.

var_dump(Carbon::now()->toDate());

date.toDateString() → string

Format the instance as date

echo Carbon::now()->toDateString();

date.toDateTime() → DateTime

Return native DateTime PHP object matching the current instance.

var_dump(Carbon::now()->toDateTime());

date.toDateTimeImmutable() → DateTimeImmutable

Return native toDateTimeImmutable PHP object matching the current instance.

var_dump(Carbon::now()->toDateTimeImmutable());

date.toDateTimeLocalString(unitPrecision?: string = "second") → string

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

echo Carbon::now()->toDateTimeLocalString(); echo “\n”; echo Carbon::now()->toDateTimeLocalString(‘minute’); // You can specify precision among: minute, second, millisecond and microsecond

date.toDateTimeString(unitPrecision?: string = "second") → string

Format the instance as date and time

echo Carbon::now()->toDateTimeString();

date.toDayDateTimeString() → string

Format the instance with day, date and time

echo Carbon::now()->toDayDateTimeString();

date.toFormattedDateString() → string

Format the instance as a readable date

echo Carbon::now()->toFormattedDateString();

date.toFormattedDayDateString() → string

Format the instance with the day, and a readable date

echo Carbon::now()->toFormattedDayDateString();

date.toISOString(keepOffset?: bool = false) → string

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).

echo Carbon::now(‘America/Toronto’)->toISOString() . “\n”; echo Carbon::now(‘America/Toronto’)->toISOString(true) . “\n”;

date.toImmutable() → CarbonImmutable

Return a immutable copy of the instance.

date.toIso8601String() → string

Format the instance as ISO8601

echo Carbon::now()->toIso8601String();

date.toIso8601ZuluString(unitPrecision?: string = "second") → string

Convert the instance to UTC and return as Zulu ISO8601

echo Carbon::now()->toIso8601ZuluString();

date.toJSON() → string

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

echo Carbon::now(‘America/Toronto’)->toJSON();

date.toMutable() → Date

Return a mutable copy of the instance.

date.toNow(syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

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

date.toObject() → object

Get default object representation.

var_dump(Carbon::now()->toObject());

date.toPeriod(end?: mixed, interval?: mixed, unit?: string) → CarbonPeriod

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

date.toRfc1036String() → string

Format the instance as RFC1036

echo Carbon::now()->toRfc1036String();

date.toRfc1123String() → string

Format the instance as RFC1123

echo Carbon::now()->toRfc1123String();

date.toRfc2822String() → string

Format the instance as RFC2822

echo Carbon::now()->toRfc2822String();

date.toRfc3339String(extended?: bool = false) → string

Format the instance as RFC3339.

echo Carbon::now()->toRfc3339String() . “\n”; echo Carbon::now()->toRfc3339String(true) . “\n”;

date.toRfc7231String() → string

Format the instance as RFC7231

echo Carbon::now()->toRfc7231String();

date.toRfc822String() → string

Format the instance as RFC822

echo Carbon::now()->toRfc822String();

date.toRfc850String() → string

Format the instance as RFC850

echo Carbon::now()->toRfc850String();

date.toRssString() → string

Format the instance as RSS

echo Carbon::now()->toRssString();

date.toString() → string

Returns english human-readable complete date string.

echo Carbon::now()->toString();

date.toTimeString(unitPrecision?: string = "second") → string

Format the instance as time

echo Carbon::now()->toTimeString();

date.toW3cString() → string

Format the instance as W3C

echo Carbon::now()->toW3cString();

date.translate(key: string, parameters?: array = [], number?: string, translator?: TranslatorInterface, altNumbers?: bool = false) → string

Translate using translation string or callback available.

date.translateNumber(number: int) → string

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

date.translateTimeStringTo(timeString: string, to?: string) → string

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

date.translatedFormat(format: string) → string

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.

date.tz(value?: DateTimeZone) → Date

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

date.unix() → int

No description yet.

date.until(other?: mixed, syntax?: mixed, short?: mixed = false, parts?: mixed = 1, options?: int) → string

No description yet.

date.utc() → Date

Set the instance’s timezone to UTC.

date.utcOffset(minuteOffset?: int) → Date

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

date.valueOf() → float

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

date.week(week?: mixed, dayOfWeek?: mixed, dayOfYear?: int) → Date

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).

date.weekOfCentury(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current century when called with no parameters, change the current week when called with an integer value

date.weekOfDecade(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current decade when called with no parameters, change the current week when called with an integer value

date.weekOfMillennium(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current millennium when called with no parameters, change the current week when called with an integer value

date.weekOfMonth(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current month when called with no parameters, change the current week when called with an integer value

date.weekOfQuarter(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current quarter when called with no parameters, change the current week when called with an integer value

date.weekOfYear(week?: ?int) → int|static

Return the value of the week starting from the beginning of the current year when called with no parameters, change the current week when called with an integer value

date.weekYear(year?: mixed, dayOfWeek?: mixed, dayOfYear?: int) → Date

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).

date.weekday(value?: WeekDay) → Date

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

date.weeksInCentury() → int

Return the number of weeks contained in the current century

date.weeksInDecade() → int

Return the number of weeks contained in the current decade

date.weeksInMillennium() → int

Return the number of weeks contained in the current millennium

date.weeksInMonth() → int

Return the number of weeks contained in the current month

date.weeksInQuarter() → int

Return the number of weeks contained in the current quarter

date.weeksInYear(dayOfWeek?: mixed, dayOfYear?: int) → int

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).

date.weeksUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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

Changes the value
date.year(value: int) → Date

Set current instance year to the given value. Changes this date in place and returns it. Use date.copy() first to keep the original.

date.yearOfCentury(year?: ?int) → int|static

Return the value of the year starting from the beginning of the current century when called with no parameters, change the current year when called with an integer value

date.yearOfDecade(year?: ?int) → int|static

Return the value of the year starting from the beginning of the current decade when called with no parameters, change the current year when called with an integer value

date.yearOfMillennium(year?: ?int) → int|static

Return the value of the year starting from the beginning of the current millennium when called with no parameters, change the current year when called with an integer value

date.years(value: int) → Date

Set current instance year to the given value.

date.yearsInCentury() → int

Return the number of years contained in the current century

date.yearsInDecade() → int

Return the number of years contained in the current decade

date.yearsInMillennium() → int

Return the number of years contained in the current millennium

date.yearsUntil(endDate?: mixed, factor?: int|float) → CarbonPeriod

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