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.
How it works
Section titled “How it works”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.
Common tasks
Section titled “Common tasks”Step through the next few working days:
set d to mash.date.parse("2026-11-03")set i to 0while i is less than 4 d.addWeekday() printline d.format("D j M") increment i by 1endWed 4 NovThu 5 NovFri 6 NovMon 9 NovFind 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-012026-02-28Measure 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.54.5Change 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:00Tuesday 3 November2026-11-03Watch out for
Section titled “Watch out for”- Dates change in place.
d.addDays(30)movesdand returns the same date. Usecopy()first, orclone(d), when you need the original too. Plain assignment (set later to start) doesn’t copy. diffInDays(other)is signed: positive whenotheris later. Passtrueas the second argument for the plain distance.addMonthcan overflow. From 31 January it lands in March.addMonthNoOverflowstops at the end of February.dayOfWeekstarts at Sunday = 0. Name the day (isMonday()) when you can.- Two dates with different times aren’t
==. To ask “same day”, useisSameDay, or comparetoDateString()values. - Time zones.
formatshows the date in its own time zone. AddPto show the offset.
See also
Section titled “See also”mash.date, and Talking to the outside world for the first look at dates.
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
age | int | |
centuriesInMillennium | int | |
century | int | |
centuryOfMillennium | int | |
day | int | |
dayName | string | |
dayOfCentury | int | |
dayOfDecade | int | |
dayOfMillennium | int | |
dayOfMonth | int | |
dayOfQuarter | int | |
dayOfWeek | int | |
dayOfWeekIso | int | |
dayOfYear | int | |
daysInCentury | int | |
daysInDecade | int | |
daysInMillennium | int | |
daysInMonth | int | |
daysInQuarter | int | |
daysInWeek | int | |
daysInYear | int | |
decade | int | |
decadeOfCentury | int | |
decadeOfMillennium | int | |
decadesInCentury | int | |
decadesInMillennium | int | |
dst | bool | |
englishDayOfWeek | string | |
englishMonth | string | |
firstWeekDay | int | |
hour | int | |
hourOfCentury | int | |
hourOfDay | int | |
hourOfDecade | int | |
hourOfMillennium | int | |
hourOfMonth | int | |
hourOfQuarter | int | |
hourOfWeek | int | |
hourOfYear | int | |
hoursInCentury | int | |
hoursInDay | int | |
hoursInDecade | int | |
hoursInMillennium | int | |
hoursInMonth | int | |
hoursInQuarter | int | |
hoursInWeek | int | |
hoursInYear | int | |
isoWeek | int | |
isoWeekYear | int | |
isoWeeksInYear | int | |
lastWeekDay | int | |
latinMeridiem | string | |
latinUpperMeridiem | string | |
local | bool | |
locale | string | |
localeDayOfWeek | string | |
localeMonth | string | |
meridiem | string | |
micro | int | |
microsecond | int | |
microsecondOfCentury | int | |
microsecondOfDay | int | |
microsecondOfDecade | int | |
microsecondOfHour | int | |
microsecondOfMillennium | int | |
microsecondOfMillisecond | int | |
microsecondOfMinute | int | |
microsecondOfMonth | int | |
microsecondOfQuarter | int | |
microsecondOfSecond | int | |
microsecondOfWeek | int | |
microsecondOfYear | int | |
microsecondsInCentury | int | |
microsecondsInDay | int | |
microsecondsInDecade | int | |
microsecondsInHour | int | |
microsecondsInMillennium | int | |
microsecondsInMillisecond | int | |
microsecondsInMinute | int | |
microsecondsInMonth | int | |
microsecondsInQuarter | int | |
microsecondsInSecond | int | |
microsecondsInWeek | int | |
microsecondsInYear | int | |
millennium | int | |
milli | int | |
millisecond | int | |
millisecondOfCentury | int | |
millisecondOfDay | int | |
millisecondOfDecade | int | |
millisecondOfHour | int | |
millisecondOfMillennium | int | |
millisecondOfMinute | int | |
millisecondOfMonth | int | |
millisecondOfQuarter | int | |
millisecondOfSecond | int | |
millisecondOfWeek | int | |
millisecondOfYear | int | |
milliseconds | int | |
millisecondsInCentury | int | |
millisecondsInDay | int | |
millisecondsInDecade | int | |
millisecondsInHour | int | |
millisecondsInMillennium | int | |
millisecondsInMinute | int | |
millisecondsInMonth | int | |
millisecondsInQuarter | int | |
millisecondsInSecond | int | |
millisecondsInWeek | int | |
millisecondsInYear | int | |
minDayName | string | |
minute | int | |
minuteOfCentury | int | |
minuteOfDay | int | |
minuteOfDecade | int | |
minuteOfHour | int | |
minuteOfMillennium | int | |
minuteOfMonth | int | |
minuteOfQuarter | int | |
minuteOfWeek | int | |
minuteOfYear | int | |
minutesInCentury | int | |
minutesInDay | int | |
minutesInDecade | int | |
minutesInHour | int | |
minutesInMillennium | int | |
minutesInMonth | int | |
minutesInQuarter | int | |
minutesInWeek | int | |
minutesInYear | int | |
month | int | |
monthName | string | |
monthOfCentury | int | |
monthOfDecade | int | |
monthOfMillennium | int | |
monthOfQuarter | int | |
monthOfYear | int | |
monthsInCentury | int | |
monthsInDecade | int | |
monthsInMillennium | int | |
monthsInQuarter | int | |
monthsInYear | int | |
noZeroHour | int | |
offset | int | |
offsetHours | int | |
offsetMinutes | int | |
quarter | int | |
quarterOfCentury | int | |
quarterOfDecade | int | |
quarterOfMillennium | int | |
quarterOfYear | int | |
quartersInCentury | int | |
quartersInDecade | int | |
quartersInMillennium | int | |
quartersInYear | int | |
second | int | |
secondOfCentury | int | |
secondOfDay | int | |
secondOfDecade | int | |
secondOfHour | int | |
secondOfMillennium | int | |
secondOfMinute | int | |
secondOfMonth | int | |
secondOfQuarter | int | |
secondOfWeek | int | |
secondOfYear | int | |
secondsInCentury | int | |
secondsInDay | int | |
secondsInDecade | int | |
secondsInHour | int | |
secondsInMillennium | int | |
secondsInMinute | int | |
secondsInMonth | int | |
secondsInQuarter | int | |
secondsInWeek | int | |
secondsInYear | int | |
shortDayName | string | |
shortEnglishDayOfWeek | string | |
shortEnglishMonth | string | |
shortLocaleDayOfWeek | string | |
shortLocaleMonth | string | |
shortMonthName | string | |
timestamp | int | float |
timezone | CarbonTimeZone | |
timezoneAbbreviatedName | string | |
timezoneName | string | |
tz | CarbonTimeZone | |
tzAbbrName | string | |
tzName | string | |
upperMeridiem | string | |
utc | bool | |
week | int | |
weekNumberInMonth | int | |
weekOfCentury | int | |
weekOfDecade | int | |
weekOfMillennium | int | |
weekOfMonth | int | |
weekOfQuarter | int | |
weekOfYear | int | |
weekYear | int | |
weeksInCentury | int | |
weeksInDecade | int | |
weeksInMillennium | int | |
weeksInMonth | int | |
weeksInQuarter | int | |
weeksInYear | int | |
year | int | |
yearIso | int | |
yearOfCentury | int | |
yearOfDecade | int | |
yearOfMillennium | int | |
yearsInCentury | int | |
yearsInDecade | int | |
yearsInMillennium | int |
Methods
Section titled “Methods”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))addCenturies
Section titled “addCenturies”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.
addCenturiesNoOverflow
Section titled “addCenturiesNoOverflow”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.
addCenturiesWithNoOverflow
Section titled “addCenturiesWithNoOverflow”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.
addCenturiesWithOverflow
Section titled “addCenturiesWithOverflow”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.
addCenturiesWithoutOverflow
Section titled “addCenturiesWithoutOverflow”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.
addCentury
Section titled “addCentury”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.
addCenturyNoOverflow
Section titled “addCenturyNoOverflow”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.
addCenturyWithNoOverflow
Section titled “addCenturyWithNoOverflow”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.
addCenturyWithOverflow
Section titled “addCenturyWithOverflow”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.
addCenturyWithoutOverflow
Section titled “addCenturyWithoutOverflow”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.
addDay
Section titled “addDay”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.
addDays
Section titled “addDays”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.
addDecade
Section titled “addDecade”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.
addDecadeNoOverflow
Section titled “addDecadeNoOverflow”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.
addDecadeWithNoOverflow
Section titled “addDecadeWithNoOverflow”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.
addDecadeWithOverflow
Section titled “addDecadeWithOverflow”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.
addDecadeWithoutOverflow
Section titled “addDecadeWithoutOverflow”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.
addDecades
Section titled “addDecades”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.
addDecadesNoOverflow
Section titled “addDecadesNoOverflow”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.
addDecadesWithNoOverflow
Section titled “addDecadesWithNoOverflow”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.
addDecadesWithOverflow
Section titled “addDecadesWithOverflow”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.
addDecadesWithoutOverflow
Section titled “addDecadesWithoutOverflow”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.
addHour
Section titled “addHour”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.
addHours
Section titled “addHours”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.
addMicro
Section titled “addMicro”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.
addMicros
Section titled “addMicros”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.
addMicrosecond
Section titled “addMicrosecond”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.
addMicroseconds
Section titled “addMicroseconds”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.
addMillennia
Section titled “addMillennia”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.
addMillenniaNoOverflow
Section titled “addMillenniaNoOverflow”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.
addMillenniaWithNoOverflow
Section titled “addMillenniaWithNoOverflow”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.
addMillenniaWithOverflow
Section titled “addMillenniaWithOverflow”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.
addMillenniaWithoutOverflow
Section titled “addMillenniaWithoutOverflow”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.
addMillennium
Section titled “addMillennium”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.
addMillenniumNoOverflow
Section titled “addMillenniumNoOverflow”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.
addMillenniumWithNoOverflow
Section titled “addMillenniumWithNoOverflow”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.
addMillenniumWithOverflow
Section titled “addMillenniumWithOverflow”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.
addMillenniumWithoutOverflow
Section titled “addMillenniumWithoutOverflow”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.
addMilli
Section titled “addMilli”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.
addMillis
Section titled “addMillis”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.
addMillisecond
Section titled “addMillisecond”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.
addMilliseconds
Section titled “addMilliseconds”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.
addMinute
Section titled “addMinute”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.
addMinutes
Section titled “addMinutes”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.
addMonth
Section titled “addMonth”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.
addMonthNoOverflow
Section titled “addMonthNoOverflow”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.
addMonthWithNoOverflow
Section titled “addMonthWithNoOverflow”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.
addMonthWithOverflow
Section titled “addMonthWithOverflow”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.
addMonthWithoutOverflow
Section titled “addMonthWithoutOverflow”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.
addMonths
Section titled “addMonths”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.
addMonthsNoOverflow
Section titled “addMonthsNoOverflow”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.
addMonthsWithNoOverflow
Section titled “addMonthsWithNoOverflow”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.
addMonthsWithOverflow
Section titled “addMonthsWithOverflow”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.
addMonthsWithoutOverflow
Section titled “addMonthsWithoutOverflow”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.
addQuarter
Section titled “addQuarter”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.
addQuarterNoOverflow
Section titled “addQuarterNoOverflow”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.
addQuarterWithNoOverflow
Section titled “addQuarterWithNoOverflow”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.
addQuarterWithOverflow
Section titled “addQuarterWithOverflow”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.
addQuarterWithoutOverflow
Section titled “addQuarterWithoutOverflow”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.
addQuarters
Section titled “addQuarters”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.
addQuartersNoOverflow
Section titled “addQuartersNoOverflow”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.
addQuartersWithNoOverflow
Section titled “addQuartersWithNoOverflow”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.
addQuartersWithOverflow
Section titled “addQuartersWithOverflow”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.
addQuartersWithoutOverflow
Section titled “addQuartersWithoutOverflow”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.
addRealUnit
Section titled “addRealUnit”date.addRealUnit(unit: string, value?: int = 1) → Date
Changes this date in place and returns it. Use date.copy() first to keep the original.
addSecond
Section titled “addSecond”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.
addSeconds
Section titled “addSeconds”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.
addUTCCenturies
Section titled “addUTCCenturies”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.
addUTCCentury
Section titled “addUTCCentury”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.
addUTCDay
Section titled “addUTCDay”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.
addUTCDays
Section titled “addUTCDays”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.
addUTCDecade
Section titled “addUTCDecade”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.
addUTCDecades
Section titled “addUTCDecades”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.
addUTCHour
Section titled “addUTCHour”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.
addUTCHours
Section titled “addUTCHours”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.
addUTCMicro
Section titled “addUTCMicro”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.
addUTCMicros
Section titled “addUTCMicros”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.
addUTCMicrosecond
Section titled “addUTCMicrosecond”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.
addUTCMicroseconds
Section titled “addUTCMicroseconds”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.
addUTCMillennia
Section titled “addUTCMillennia”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.
addUTCMillennium
Section titled “addUTCMillennium”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.
addUTCMilli
Section titled “addUTCMilli”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.
addUTCMillis
Section titled “addUTCMillis”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.
addUTCMillisecond
Section titled “addUTCMillisecond”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.
addUTCMilliseconds
Section titled “addUTCMilliseconds”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.
addUTCMinute
Section titled “addUTCMinute”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.
addUTCMinutes
Section titled “addUTCMinutes”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.
addUTCMonth
Section titled “addUTCMonth”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.
addUTCMonths
Section titled “addUTCMonths”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.
addUTCQuarter
Section titled “addUTCQuarter”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.
addUTCQuarters
Section titled “addUTCQuarters”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.
addUTCSecond
Section titled “addUTCSecond”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.
addUTCSeconds
Section titled “addUTCSeconds”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.
addUTCUnit
Section titled “addUTCUnit”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.
addUTCWeek
Section titled “addUTCWeek”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.
addUTCWeeks
Section titled “addUTCWeeks”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.
addUTCYear
Section titled “addUTCYear”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.
addUTCYears
Section titled “addUTCYears”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.
addUnit
Section titled “addUnit”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.
addUnitNoOverflow
Section titled “addUnitNoOverflow”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.
addWeek
Section titled “addWeek”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.
addWeekday
Section titled “addWeekday”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.
addWeekdays
Section titled “addWeekdays”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.
addWeeks
Section titled “addWeeks”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.
addYear
Section titled “addYear”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.
addYearNoOverflow
Section titled “addYearNoOverflow”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.
addYearWithNoOverflow
Section titled “addYearWithNoOverflow”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.
addYearWithOverflow
Section titled “addYearWithOverflow”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.
addYearWithoutOverflow
Section titled “addYearWithoutOverflow”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.
addYears
Section titled “addYears”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.
addYearsNoOverflow
Section titled “addYearsNoOverflow”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.
addYearsWithNoOverflow
Section titled “addYearsWithNoOverflow”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.
addYearsWithOverflow
Section titled “addYearsWithOverflow”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.
addYearsWithoutOverflow
Section titled “addYearsWithoutOverflow”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
average
Section titled “average”date.average(date?: Date) → Date
Modify the current instance to the average of a given instance (default now) and the current instance (second-precision).
avoidMutation
Section titled “avoidMutation”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.
between
Section titled “between”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
betweenExcluded
Section titled “betweenExcluded”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
betweenIncluded
Section titled “betweenIncluded”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
calendar
Section titled “calendar”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.
carbonize
Section titled “carbonize”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.
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.
ceilCenturies
Section titled “ceilCenturies”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.
ceilCentury
Section titled “ceilCentury”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.
ceilDay
Section titled “ceilDay”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.
ceilDays
Section titled “ceilDays”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.
ceilDecade
Section titled “ceilDecade”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.
ceilDecades
Section titled “ceilDecades”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.
ceilHour
Section titled “ceilHour”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.
ceilHours
Section titled “ceilHours”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.
ceilMicrosecond
Section titled “ceilMicrosecond”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.
ceilMicroseconds
Section titled “ceilMicroseconds”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.
ceilMillennia
Section titled “ceilMillennia”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.
ceilMillennium
Section titled “ceilMillennium”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.
ceilMillisecond
Section titled “ceilMillisecond”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.
ceilMilliseconds
Section titled “ceilMilliseconds”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.
ceilMinute
Section titled “ceilMinute”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.
ceilMinutes
Section titled “ceilMinutes”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.
ceilMonth
Section titled “ceilMonth”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.
ceilMonths
Section titled “ceilMonths”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.
ceilQuarter
Section titled “ceilQuarter”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.
ceilQuarters
Section titled “ceilQuarters”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.
ceilSecond
Section titled “ceilSecond”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.
ceilSeconds
Section titled “ceilSeconds”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.
ceilUnit
Section titled “ceilUnit”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.
ceilWeek
Section titled “ceilWeek”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.
ceilYear
Section titled “ceilYear”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.
ceilYears
Section titled “ceilYears”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.
centuriesInMillennium
Section titled “centuriesInMillennium”date.centuriesInMillennium() → int
Return the number of centuries contained in the current millennium
centuriesUntil
Section titled “centuriesUntil”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.
centuryOfMillennium
Section titled “centuryOfMillennium”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
change
Section titled “change”date.change(modifier: string) → Date
Similar to native modify() method of DateTime but can handle more grammars.
echo Carbon::now()->change(‘next 2pm’);
cleanupDumpProperties
Section titled “cleanupDumpProperties”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.
closest
Section titled “closest”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.
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.
dayOfCentury
Section titled “dayOfCentury”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
dayOfDecade
Section titled “dayOfDecade”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
dayOfMillennium
Section titled “dayOfMillennium”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
dayOfMonth
Section titled “dayOfMonth”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
dayOfQuarter
Section titled “dayOfQuarter”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
dayOfWeek
Section titled “dayOfWeek”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
dayOfYear
Section titled “dayOfYear”date.dayOfYear(value?: int) → Date
Get/set the day of year.
date.days(value: int) → Date
Set current instance day to the given value.
daysInCentury
Section titled “daysInCentury”date.daysInCentury() → int
Return the number of days contained in the current century
daysInDecade
Section titled “daysInDecade”date.daysInDecade() → int
Return the number of days contained in the current decade
daysInMillennium
Section titled “daysInMillennium”date.daysInMillennium() → int
Return the number of days contained in the current millennium
daysInMonth
Section titled “daysInMonth”date.daysInMonth() → int
Return the number of days contained in the current month
daysInQuarter
Section titled “daysInQuarter”date.daysInQuarter() → int
Return the number of days contained in the current quarter
daysInWeek
Section titled “daysInWeek”date.daysInWeek() → int
Return the number of days contained in the current week
daysInYear
Section titled “daysInYear”date.daysInYear() → int
Return the number of days contained in the current year
daysUntil
Section titled “daysUntil”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.
decadeOfCentury
Section titled “decadeOfCentury”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
decadeOfMillennium
Section titled “decadeOfMillennium”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
decadesInCentury
Section titled “decadesInCentury”date.decadesInCentury() → int
Return the number of decades contained in the current century
decadesInMillennium
Section titled “decadesInMillennium”date.decadesInMillennium() → int
Return the number of decades contained in the current millennium
decadesUntil
Section titled “decadesUntil”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.
diffAsCarbonInterval
Section titled “diffAsCarbonInterval”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).
diffAsDateInterval
Section titled “diffAsDateInterval”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).
diffFiltered
Section titled “diffFiltered”date.diffFiltered(ci: CarbonInterval, callback: Block, date?: mixed, absolute?: bool = false) → int
Get the difference by the given interval using a filter closure.
diffForHumans
Section titled “diffForHumans”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”;
diffInDays
Section titled “diffInDays”date.diffInDays(date?: mixed, absolute?: bool = false, utc?: bool = false) → float
Get the difference in days.
diffInDaysFiltered
Section titled “diffInDaysFiltered”date.diffInDaysFiltered(callback: Block, date?: mixed, absolute?: bool = false) → int
Get the difference in days using a filter closure.
diffInHours
Section titled “diffInHours”date.diffInHours(date?: mixed, absolute?: bool = false) → float
Get the difference in hours.
diffInHoursFiltered
Section titled “diffInHoursFiltered”date.diffInHoursFiltered(callback: Block, date?: mixed, absolute?: bool = false) → int
Get the difference in hours using a filter closure.
diffInMicroseconds
Section titled “diffInMicroseconds”date.diffInMicroseconds(date?: mixed, absolute?: bool = false) → float
Get the difference in microseconds.
diffInMilliseconds
Section titled “diffInMilliseconds”date.diffInMilliseconds(date?: mixed, absolute?: bool = false) → float
Get the difference in milliseconds.
diffInMinutes
Section titled “diffInMinutes”date.diffInMinutes(date?: mixed, absolute?: bool = false) → float
Get the difference in minutes.
diffInMonths
Section titled “diffInMonths”date.diffInMonths(date?: mixed, absolute?: bool = false, utc?: bool = false) → float
Get the difference in months.
diffInQuarters
Section titled “diffInQuarters”date.diffInQuarters(date?: mixed, absolute?: bool = false, utc?: bool = false) → float
Get the difference in quarters.
diffInSeconds
Section titled “diffInSeconds”date.diffInSeconds(date?: mixed, absolute?: bool = false) → float
Get the difference in seconds.
diffInUTCCenturies
Section titled “diffInUTCCenturies”date.diffInUTCCenturies(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of centuries.
diffInUTCDays
Section titled “diffInUTCDays”date.diffInUTCDays(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of days.
diffInUTCDecades
Section titled “diffInUTCDecades”date.diffInUTCDecades(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of decades.
diffInUTCHours
Section titled “diffInUTCHours”date.diffInUTCHours(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of hours.
diffInUTCMicros
Section titled “diffInUTCMicros”date.diffInUTCMicros(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of microseconds.
diffInUTCMicroseconds
Section titled “diffInUTCMicroseconds”date.diffInUTCMicroseconds(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of microseconds.
diffInUTCMillennia
Section titled “diffInUTCMillennia”date.diffInUTCMillennia(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of millennia.
diffInUTCMillis
Section titled “diffInUTCMillis”date.diffInUTCMillis(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of milliseconds.
diffInUTCMilliseconds
Section titled “diffInUTCMilliseconds”date.diffInUTCMilliseconds(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of milliseconds.
diffInUTCMinutes
Section titled “diffInUTCMinutes”date.diffInUTCMinutes(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of minutes.
diffInUTCMonths
Section titled “diffInUTCMonths”date.diffInUTCMonths(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of months.
diffInUTCQuarters
Section titled “diffInUTCQuarters”date.diffInUTCQuarters(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of quarters.
diffInUTCSeconds
Section titled “diffInUTCSeconds”date.diffInUTCSeconds(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of seconds.
diffInUTCWeeks
Section titled “diffInUTCWeeks”date.diffInUTCWeeks(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of weeks.
diffInUTCYears
Section titled “diffInUTCYears”date.diffInUTCYears(date: DateTimeInterface|string|null, absolute?: bool) → float
Convert current and given date in UTC timezone and return a floating number of years.
diffInUnit
Section titled “diffInUnit”date.diffInUnit(unit: Unit, date?: mixed, absolute?: bool = false, utc?: bool = false) → float
No description yet.
diffInWeekdays
Section titled “diffInWeekdays”date.diffInWeekdays(date?: mixed, absolute?: bool = false) → int
Get the difference in weekdays.
diffInWeekendDays
Section titled “diffInWeekendDays”date.diffInWeekendDays(date?: mixed, absolute?: bool = false) → int
Get the difference in weekend days using a filter.
diffInWeeks
Section titled “diffInWeeks”date.diffInWeeks(date?: mixed, absolute?: bool = false, utc?: bool = false) → float
Get the difference in weeks.
diffInYears
Section titled “diffInYears”date.diffInYears(date?: mixed, absolute?: bool = false, utc?: bool = false) → float
Get the difference in years
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);
endOfCentury
Section titled “endOfCentury”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();
endOfDay
Section titled “endOfDay”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();
endOfDecade
Section titled “endOfDecade”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();
endOfHour
Section titled “endOfHour”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();
endOfMillennium
Section titled “endOfMillennium”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();
endOfMillisecond
Section titled “endOfMillisecond”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’);
endOfMinute
Section titled “endOfMinute”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();
endOfMonth
Section titled “endOfMonth”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();
endOfQuarter
Section titled “endOfQuarter”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();
endOfSecond
Section titled “endOfSecond”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’);
endOfWeek
Section titled “endOfWeek”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”;
endOfYear
Section titled “endOfYear”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
equalTo
Section titled “equalTo”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
farthest
Section titled “farthest”date.farthest(date1: mixed, date2: Date) → Date
Get the farthest date from the instance (second-precision).
firstOfMonth
Section titled “firstOfMonth”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.
firstOfQuarter
Section titled “firstOfQuarter”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.
firstOfYear
Section titled “firstOfYear”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.
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.
floorCenturies
Section titled “floorCenturies”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.
floorCentury
Section titled “floorCentury”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.
floorDay
Section titled “floorDay”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.
floorDays
Section titled “floorDays”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.
floorDecade
Section titled “floorDecade”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.
floorDecades
Section titled “floorDecades”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.
floorHour
Section titled “floorHour”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.
floorHours
Section titled “floorHours”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.
floorMicrosecond
Section titled “floorMicrosecond”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.
floorMicroseconds
Section titled “floorMicroseconds”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.
floorMillennia
Section titled “floorMillennia”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.
floorMillennium
Section titled “floorMillennium”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.
floorMillisecond
Section titled “floorMillisecond”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.
floorMilliseconds
Section titled “floorMilliseconds”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.
floorMinute
Section titled “floorMinute”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.
floorMinutes
Section titled “floorMinutes”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.
floorMonth
Section titled “floorMonth”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.
floorMonths
Section titled “floorMonths”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.
floorQuarter
Section titled “floorQuarter”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.
floorQuarters
Section titled “floorQuarters”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.
floorSecond
Section titled “floorSecond”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.
floorSeconds
Section titled “floorSeconds”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.
floorUnit
Section titled “floorUnit”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.
floorWeek
Section titled “floorWeek”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.
floorYear
Section titled “floorYear”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.
floorYears
Section titled “floorYears”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.
format
Section titled “format”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.
fromNow
Section titled “fromNow”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.
getAltNumber
Section titled “getAltNumber”date.getAltNumber(key: string) → string
Returns the alternative number for a given date property if available in the current locale.
getCalendarFormats
Section titled “getCalendarFormats”date.getCalendarFormats(locale?: string) → array
Returns list of calendar formats for ISO formatting.
getClock
Section titled “getClock”date.getClock() → WrapperClock
No description yet.
getDaysFromStartOfWeek
Section titled “getDaysFromStartOfWeek”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).
getIsoFormats
Section titled “getIsoFormats”date.getIsoFormats(locale?: string) → array
Returns list of locale formats for ISO formatting.
getMicrosecond
Section titled “getMicrosecond”date.getMicrosecond() → int
No description yet.
getOffset
Section titled “getOffset”date.getOffset()
No description yet.
getOffsetString
Section titled “getOffsetString”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”.
getPaddedUnit
Section titled “getPaddedUnit”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.
getPreciseTimestamp
Section titled “getPreciseTimestamp”date.getPreciseTimestamp(precision?: int = 6) → float
Returns a timestamp rounded with the given precision (6 by default).
getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)getPreciseTimestamp(6) 1532087464437474getPreciseTimestamp(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)getSettings
Section titled “getSettings”date.getSettings() → array
Returns current local settings.
getTimestamp
Section titled “getTimestamp”date.getTimestamp()
No description yet.
getTimestampMs
Section titled “getTimestampMs”date.getTimestampMs() → int
Returns the timestamp with millisecond precision.
getTimezone
Section titled “getTimezone”date.getTimezone() → CarbonTimeZone
Get the TimeZone associated with the Carbon instance (as CarbonTimeZone).
getTranslatedDayName
Section titled “getTranslatedDayName”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).
getTranslatedMinDayName
Section titled “getTranslatedMinDayName”date.getTranslatedMinDayName(context?: string) → string
Get the translation of the current abbreviated week day name (with context for languages with multiple forms).
getTranslatedMonthName
Section titled “getTranslatedMonthName”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).
getTranslatedShortDayName
Section titled “getTranslatedShortDayName”date.getTranslatedShortDayName(context?: string) → string
Get the translation of the current short week day name (with context for languages with multiple forms).
getTranslatedShortMonthName
Section titled “getTranslatedShortMonthName”date.getTranslatedShortMonthName(context?: string) → string
Get the translation of the current short month day name (with context for languages with multiple forms).
getTranslationMessage
Section titled “getTranslationMessage”date.getTranslationMessage(key: string, locale?: string, default?: string, translator?: TranslatorInterface) → string
Returns raw translation message for a given key.
greaterThan
Section titled “greaterThan”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
greaterThanOrEqualTo
Section titled “greaterThanOrEqualTo”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
hasLocalMacro
Section titled “hasLocalMacro”date.hasLocalMacro(name: string) → bool
Checks if macro is registered globally or locally.
hasLocalTranslator
Section titled “hasLocalTranslator”date.hasLocalTranslator() → bool
Return true if the current instance has its own translator.
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.
hourOfCentury
Section titled “hourOfCentury”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
hourOfDay
Section titled “hourOfDay”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
hourOfDecade
Section titled “hourOfDecade”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
hourOfMillennium
Section titled “hourOfMillennium”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
hourOfMonth
Section titled “hourOfMonth”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
hourOfQuarter
Section titled “hourOfQuarter”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
hourOfWeek
Section titled “hourOfWeek”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
hourOfYear
Section titled “hourOfYear”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.
hoursInCentury
Section titled “hoursInCentury”date.hoursInCentury() → int
Return the number of hours contained in the current century
hoursInDay
Section titled “hoursInDay”date.hoursInDay() → int
Return the number of hours contained in the current day
hoursInDecade
Section titled “hoursInDecade”date.hoursInDecade() → int
Return the number of hours contained in the current decade
hoursInMillennium
Section titled “hoursInMillennium”date.hoursInMillennium() → int
Return the number of hours contained in the current millennium
hoursInMonth
Section titled “hoursInMonth”date.hoursInMonth() → int
Return the number of hours contained in the current month
hoursInQuarter
Section titled “hoursInQuarter”date.hoursInQuarter() → int
Return the number of hours contained in the current quarter
hoursInWeek
Section titled “hoursInWeek”date.hoursInWeek() → int
Return the number of hours contained in the current week
hoursInYear
Section titled “hoursInYear”date.hoursInYear() → int
Return the number of hours contained in the current year
hoursUntil
Section titled “hoursUntil”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
isAfter
Section titled “isAfter”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
isBefore
Section titled “isBefore”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
isBetween
Section titled “isBetween”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
isBirthday
Section titled “isBirthday”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
isCurrentCentury
Section titled “isCurrentCentury”date.isCurrentCentury() → bool
Checks if the instance is in the same century as the current moment.
isCurrentDay
Section titled “isCurrentDay”date.isCurrentDay() → bool
Checks if the instance is in the same day as the current moment.
isCurrentDecade
Section titled “isCurrentDecade”date.isCurrentDecade() → bool
Checks if the instance is in the same decade as the current moment.
isCurrentHour
Section titled “isCurrentHour”date.isCurrentHour() → bool
Checks if the instance is in the same hour as the current moment.
isCurrentMicro
Section titled “isCurrentMicro”date.isCurrentMicro() → bool
Checks if the instance is in the same microsecond as the current moment.
isCurrentMicrosecond
Section titled “isCurrentMicrosecond”date.isCurrentMicrosecond() → bool
Checks if the instance is in the same microsecond as the current moment.
isCurrentMillennium
Section titled “isCurrentMillennium”date.isCurrentMillennium() → bool
Checks if the instance is in the same millennium as the current moment.
isCurrentMilli
Section titled “isCurrentMilli”date.isCurrentMilli() → bool
Checks if the instance is in the same millisecond as the current moment.
isCurrentMillisecond
Section titled “isCurrentMillisecond”date.isCurrentMillisecond() → bool
Checks if the instance is in the same millisecond as the current moment.
isCurrentMinute
Section titled “isCurrentMinute”date.isCurrentMinute() → bool
Checks if the instance is in the same minute as the current moment.
isCurrentMonth
Section titled “isCurrentMonth”date.isCurrentMonth() → bool
Checks if the instance is in the same month as the current moment.
isCurrentQuarter
Section titled “isCurrentQuarter”date.isCurrentQuarter() → bool
Checks if the instance is in the same quarter as the current moment.
isCurrentSecond
Section titled “isCurrentSecond”date.isCurrentSecond() → bool
Checks if the instance is in the same second as the current moment.
isCurrentUnit
Section titled “isCurrentUnit”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
isCurrentWeek
Section titled “isCurrentWeek”date.isCurrentWeek() → bool
Checks if the instance is in the same week as the current moment.
isCurrentYear
Section titled “isCurrentYear”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.
isDayOfWeek
Section titled “isDayOfWeek”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
isEndOfCentury
Section titled “isEndOfCentury”date.isEndOfCentury(interval?: Unit) → bool
Determines if the instance is end of century (last day by default but interval can be customized).
isEndOfDay
Section titled “isEndOfDay”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
isEndOfDecade
Section titled “isEndOfDecade”date.isEndOfDecade(interval?: Unit) → bool
Determines if the instance is end of decade (last day by default but interval can be customized).
isEndOfHour
Section titled “isEndOfHour”date.isEndOfHour(interval?: Unit) → bool
Determines if the instance is end of hour (last microsecond by default but interval can be customized).
isEndOfMillennium
Section titled “isEndOfMillennium”date.isEndOfMillennium(interval?: Unit) → bool
Determines if the instance is end of millennium (last day by default but interval can be customized).
isEndOfMillisecond
Section titled “isEndOfMillisecond”date.isEndOfMillisecond(interval?: Unit) → bool
Determines if the instance is end of millisecond (last microsecond by default but interval can be customized).
isEndOfMinute
Section titled “isEndOfMinute”date.isEndOfMinute(interval?: Unit) → bool
Determines if the instance is end of minute (last microsecond by default but interval can be customized).
isEndOfMonth
Section titled “isEndOfMonth”date.isEndOfMonth(interval?: Unit) → bool
Determines if the instance is end of month (last day by default but interval can be customized).
isEndOfQuarter
Section titled “isEndOfQuarter”date.isEndOfQuarter(interval?: Unit) → bool
Determines if the instance is end of quarter (last day by default but interval can be customized).
isEndOfSecond
Section titled “isEndOfSecond”date.isEndOfSecond(interval?: Unit) → bool
Determines if the instance is end of second (last microsecond by default but interval can be customized).
isEndOfTime
Section titled “isEndOfTime”date.isEndOfTime() → bool
Returns true if the date was created using CarbonImmutable::endOfTime()
isEndOfUnit
Section titled “isEndOfUnit”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
isEndOfWeek
Section titled “isEndOfWeek”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
isEndOfYear
Section titled “isEndOfYear”date.isEndOfYear(interval?: Unit) → bool
Determines if the instance is end of year (last day by default but interval can be customized).
isFriday
Section titled “isFriday”date.isFriday() → bool
Checks if the instance day is friday.
isFuture
Section titled “isFuture”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
isLastCentury
Section titled “isLastCentury”date.isLastCentury() → bool
Checks if the instance is in the same century as the current moment last century.
isLastDay
Section titled “isLastDay”date.isLastDay() → bool
Checks if the instance is in the same day as the current moment last day.
isLastDecade
Section titled “isLastDecade”date.isLastDecade() → bool
Checks if the instance is in the same decade as the current moment last decade.
isLastHour
Section titled “isLastHour”date.isLastHour() → bool
Checks if the instance is in the same hour as the current moment last hour.
isLastMicro
Section titled “isLastMicro”date.isLastMicro() → bool
Checks if the instance is in the same microsecond as the current moment last microsecond.
isLastMicrosecond
Section titled “isLastMicrosecond”date.isLastMicrosecond() → bool
Checks if the instance is in the same microsecond as the current moment last microsecond.
isLastMillennium
Section titled “isLastMillennium”date.isLastMillennium() → bool
Checks if the instance is in the same millennium as the current moment last millennium.
isLastMilli
Section titled “isLastMilli”date.isLastMilli() → bool
Checks if the instance is in the same millisecond as the current moment last millisecond.
isLastMillisecond
Section titled “isLastMillisecond”date.isLastMillisecond() → bool
Checks if the instance is in the same millisecond as the current moment last millisecond.
isLastMinute
Section titled “isLastMinute”date.isLastMinute() → bool
Checks if the instance is in the same minute as the current moment last minute.
isLastMonth
Section titled “isLastMonth”date.isLastMonth() → bool
Checks if the instance is in the same month as the current moment last month.
isLastOfMonth
Section titled “isLastOfMonth”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
isLastQuarter
Section titled “isLastQuarter”date.isLastQuarter() → bool
Checks if the instance is in the same quarter as the current moment last quarter.
isLastSecond
Section titled “isLastSecond”date.isLastSecond() → bool
Checks if the instance is in the same second as the current moment last second.
isLastWeek
Section titled “isLastWeek”date.isLastWeek() → bool
Checks if the instance is in the same week as the current moment last week.
isLastYear
Section titled “isLastYear”date.isLastYear() → bool
Checks if the instance is in the same year as the current moment last year.
isLeapYear
Section titled “isLeapYear”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
isLocal
Section titled “isLocal”date.isLocal() → bool
Check if the current instance has non-UTC timezone.
isLongIsoYear
Section titled “isLongIsoYear”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
isLongYear
Section titled “isLongYear”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
isMidday
Section titled “isMidday”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
isMidnight
Section titled “isMidnight”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
isMonday
Section titled “isMonday”date.isMonday() → bool
Checks if the instance day is monday.
isNextCentury
Section titled “isNextCentury”date.isNextCentury() → bool
Checks if the instance is in the same century as the current moment next century.
isNextDay
Section titled “isNextDay”date.isNextDay() → bool
Checks if the instance is in the same day as the current moment next day.
isNextDecade
Section titled “isNextDecade”date.isNextDecade() → bool
Checks if the instance is in the same decade as the current moment next decade.
isNextHour
Section titled “isNextHour”date.isNextHour() → bool
Checks if the instance is in the same hour as the current moment next hour.
isNextMicro
Section titled “isNextMicro”date.isNextMicro() → bool
Checks if the instance is in the same microsecond as the current moment next microsecond.
isNextMicrosecond
Section titled “isNextMicrosecond”date.isNextMicrosecond() → bool
Checks if the instance is in the same microsecond as the current moment next microsecond.
isNextMillennium
Section titled “isNextMillennium”date.isNextMillennium() → bool
Checks if the instance is in the same millennium as the current moment next millennium.
isNextMilli
Section titled “isNextMilli”date.isNextMilli() → bool
Checks if the instance is in the same millisecond as the current moment next millisecond.
isNextMillisecond
Section titled “isNextMillisecond”date.isNextMillisecond() → bool
Checks if the instance is in the same millisecond as the current moment next millisecond.
isNextMinute
Section titled “isNextMinute”date.isNextMinute() → bool
Checks if the instance is in the same minute as the current moment next minute.
isNextMonth
Section titled “isNextMonth”date.isNextMonth() → bool
Checks if the instance is in the same month as the current moment next month.
isNextQuarter
Section titled “isNextQuarter”date.isNextQuarter() → bool
Checks if the instance is in the same quarter as the current moment next quarter.
isNextSecond
Section titled “isNextSecond”date.isNextSecond() → bool
Checks if the instance is in the same second as the current moment next second.
isNextWeek
Section titled “isNextWeek”date.isNextWeek() → bool
Checks if the instance is in the same week as the current moment next week.
isNextYear
Section titled “isNextYear”date.isNextYear() → bool
Checks if the instance is in the same year as the current moment next year.
isNowOrFuture
Section titled “isNowOrFuture”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
isNowOrPast
Section titled “isNowOrPast”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
isPast
Section titled “isPast”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
isSameAs
Section titled “isSameAs”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
isSameCentury
Section titled “isSameCentury”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).
isSameDay
Section titled “isSameDay”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).
isSameDecade
Section titled “isSameDecade”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).
isSameHour
Section titled “isSameHour”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).
isSameMicro
Section titled “isSameMicro”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).
isSameMicrosecond
Section titled “isSameMicrosecond”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).
isSameMillennium
Section titled “isSameMillennium”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).
isSameMilli
Section titled “isSameMilli”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).
isSameMillisecond
Section titled “isSameMillisecond”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).
isSameMinute
Section titled “isSameMinute”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).
isSameMonth
Section titled “isSameMonth”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
isSameQuarter
Section titled “isSameQuarter”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
isSameSecond
Section titled “isSameSecond”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).
isSameUnit
Section titled “isSameUnit”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
isSameWeek
Section titled “isSameWeek”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).
isSameYear
Section titled “isSameYear”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).
isSaturday
Section titled “isSaturday”date.isSaturday() → bool
Checks if the instance day is saturday.
isStartOfCentury
Section titled “isStartOfCentury”date.isStartOfCentury(interval?: Unit) → bool
Determines if the instance is start of century (first day by default but interval can be customized).
isStartOfDay
Section titled “isStartOfDay”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
isStartOfDecade
Section titled “isStartOfDecade”date.isStartOfDecade(interval?: Unit) → bool
Determines if the instance is start of decade (first day by default but interval can be customized).
isStartOfHour
Section titled “isStartOfHour”date.isStartOfHour(interval?: Unit) → bool
Determines if the instance is start of hour (first microsecond by default but interval can be customized).
isStartOfMillennium
Section titled “isStartOfMillennium”date.isStartOfMillennium(interval?: Unit) → bool
Determines if the instance is start of millennium (first day by default but interval can be customized).
isStartOfMillisecond
Section titled “isStartOfMillisecond”date.isStartOfMillisecond(interval?: Unit) → bool
Determines if the instance is start of millisecond (first microsecond by default but interval can be customized).
isStartOfMinute
Section titled “isStartOfMinute”date.isStartOfMinute(interval?: Unit) → bool
Determines if the instance is start of minute (first microsecond by default but interval can be customized).
isStartOfMonth
Section titled “isStartOfMonth”date.isStartOfMonth(interval?: Unit) → bool
Determines if the instance is start of month (first day by default but interval can be customized).
isStartOfQuarter
Section titled “isStartOfQuarter”date.isStartOfQuarter(interval?: Unit) → bool
Determines if the instance is start of quarter (first day by default but interval can be customized).
isStartOfSecond
Section titled “isStartOfSecond”date.isStartOfSecond(interval?: Unit) → bool
Determines if the instance is start of second (first microsecond by default but interval can be customized).
isStartOfTime
Section titled “isStartOfTime”date.isStartOfTime() → bool
Returns true if the date was created using CarbonImmutable::startOfTime()
isStartOfUnit
Section titled “isStartOfUnit”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
isStartOfWeek
Section titled “isStartOfWeek”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
isStartOfYear
Section titled “isStartOfYear”date.isStartOfYear(interval?: Unit) → bool
Determines if the instance is start of year (first day by default but interval can be customized).
isSunday
Section titled “isSunday”date.isSunday() → bool
Checks if the instance day is sunday.
isThursday
Section titled “isThursday”date.isThursday() → bool
Checks if the instance day is thursday.
isToday
Section titled “isToday”date.isToday() → bool
Determines if the instance is today.
Carbon::today()->isToday(); // true Carbon::tomorrow()->isToday(); // false
isTomorrow
Section titled “isTomorrow”date.isTomorrow() → bool
Determines if the instance is tomorrow.
Carbon::tomorrow()->isTomorrow(); // true Carbon::yesterday()->isTomorrow(); // false
isTuesday
Section titled “isTuesday”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.)
isValid
Section titled “isValid”date.isValid() → bool
Check if the current instance is a valid date.
isWednesday
Section titled “isWednesday”date.isWednesday() → bool
Checks if the instance day is wednesday.
isWeekday
Section titled “isWeekday”date.isWeekday() → bool
Determines if the instance is a weekday.
Carbon::parse(‘2019-07-14’)->isWeekday(); // false Carbon::parse(‘2019-07-15’)->isWeekday(); // true
isWeekend
Section titled “isWeekend”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
isYesterday
Section titled “isYesterday”date.isYesterday() → bool
Determines if the instance is yesterday.
Carbon::yesterday()->isYesterday(); // true Carbon::tomorrow()->isYesterday(); // false
isoFormat
Section titled “isoFormat”date.isoFormat(format: string, originalFormat?: string) → string
Format in the current language using ISO replacement patterns.
isoWeek
Section titled “isoWeek”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.
isoWeekYear
Section titled “isoWeekYear”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.
isoWeekday
Section titled “isoWeekday”date.isoWeekday(value?: WeekDay) → Date
Get/set the ISO weekday from 1 (Monday) to 7 (Sunday).
isoWeeksInYear
Section titled “isoWeeksInYear”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.
lastOfMonth
Section titled “lastOfMonth”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.
lastOfQuarter
Section titled “lastOfQuarter”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.
lastOfYear
Section titled “lastOfYear”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.
lessThan
Section titled “lessThan”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
lessThanOrEqualTo
Section titled “lessThanOrEqualTo”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
locale
Section titled “locale”date.locale(locale?: string, fallbackLocales?: string) → Date
Get/set the locale for the current instance.
longAbsoluteDiffForHumans
Section titled “longAbsoluteDiffForHumans”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.)
longRelativeDiffForHumans
Section titled “longRelativeDiffForHumans”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.)
longRelativeToNowDiffForHumans
Section titled “longRelativeToNowDiffForHumans”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.)
longRelativeToOtherDiffForHumans
Section titled “longRelativeToOtherDiffForHumans”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.
maximum
Section titled “maximum”date.maximum(date?: Date) → Date
Get the maximum instance between a given instance (default now) and the current instance.
meridiem
Section titled “meridiem”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.
micros
Section titled “micros”date.micros(value: int) → Date
Set current instance microsecond to the given value.
microsUntil
Section titled “microsUntil”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.
microsecond
Section titled “microsecond”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.
microsecondOfCentury
Section titled “microsecondOfCentury”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
microsecondOfDay
Section titled “microsecondOfDay”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
microsecondOfDecade
Section titled “microsecondOfDecade”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
microsecondOfHour
Section titled “microsecondOfHour”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
microsecondOfMillennium
Section titled “microsecondOfMillennium”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
microsecondOfMillisecond
Section titled “microsecondOfMillisecond”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
microsecondOfMinute
Section titled “microsecondOfMinute”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
microsecondOfMonth
Section titled “microsecondOfMonth”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
microsecondOfQuarter
Section titled “microsecondOfQuarter”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
microsecondOfSecond
Section titled “microsecondOfSecond”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
microsecondOfWeek
Section titled “microsecondOfWeek”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
microsecondOfYear
Section titled “microsecondOfYear”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
microseconds
Section titled “microseconds”date.microseconds(value: int) → Date
Set current instance microsecond to the given value.
microsecondsInCentury
Section titled “microsecondsInCentury”date.microsecondsInCentury() → int
Return the number of microseconds contained in the current century
microsecondsInDay
Section titled “microsecondsInDay”date.microsecondsInDay() → int
Return the number of microseconds contained in the current day
microsecondsInDecade
Section titled “microsecondsInDecade”date.microsecondsInDecade() → int
Return the number of microseconds contained in the current decade
microsecondsInHour
Section titled “microsecondsInHour”date.microsecondsInHour() → int
Return the number of microseconds contained in the current hour
microsecondsInMillennium
Section titled “microsecondsInMillennium”date.microsecondsInMillennium() → int
Return the number of microseconds contained in the current millennium
microsecondsInMillisecond
Section titled “microsecondsInMillisecond”date.microsecondsInMillisecond() → int
Return the number of microseconds contained in the current millisecond
microsecondsInMinute
Section titled “microsecondsInMinute”date.microsecondsInMinute() → int
Return the number of microseconds contained in the current minute
microsecondsInMonth
Section titled “microsecondsInMonth”date.microsecondsInMonth() → int
Return the number of microseconds contained in the current month
microsecondsInQuarter
Section titled “microsecondsInQuarter”date.microsecondsInQuarter() → int
Return the number of microseconds contained in the current quarter
microsecondsInSecond
Section titled “microsecondsInSecond”date.microsecondsInSecond() → int
Return the number of microseconds contained in the current second
microsecondsInWeek
Section titled “microsecondsInWeek”date.microsecondsInWeek() → int
Return the number of microseconds contained in the current week
microsecondsInYear
Section titled “microsecondsInYear”date.microsecondsInYear() → int
Return the number of microseconds contained in the current year
microsecondsUntil
Section titled “microsecondsUntil”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.
midDay
Section titled “midDay”date.midDay() → Date
Modify to midday, default to self::$midDayAt
millenniaUntil
Section titled “millenniaUntil”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.
millis
Section titled “millis”date.millis(value: int) → Date
Set current instance millisecond to the given value.
millisUntil
Section titled “millisUntil”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.
millisecond
Section titled “millisecond”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.
millisecondOfCentury
Section titled “millisecondOfCentury”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
millisecondOfDay
Section titled “millisecondOfDay”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
millisecondOfDecade
Section titled “millisecondOfDecade”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
millisecondOfHour
Section titled “millisecondOfHour”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
millisecondOfMillennium
Section titled “millisecondOfMillennium”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
millisecondOfMinute
Section titled “millisecondOfMinute”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
millisecondOfMonth
Section titled “millisecondOfMonth”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
millisecondOfQuarter
Section titled “millisecondOfQuarter”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
millisecondOfSecond
Section titled “millisecondOfSecond”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
millisecondOfWeek
Section titled “millisecondOfWeek”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
millisecondOfYear
Section titled “millisecondOfYear”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
milliseconds
Section titled “milliseconds”date.milliseconds(value: int) → Date
Set current instance millisecond to the given value.
millisecondsInCentury
Section titled “millisecondsInCentury”date.millisecondsInCentury() → int
Return the number of milliseconds contained in the current century
millisecondsInDay
Section titled “millisecondsInDay”date.millisecondsInDay() → int
Return the number of milliseconds contained in the current day
millisecondsInDecade
Section titled “millisecondsInDecade”date.millisecondsInDecade() → int
Return the number of milliseconds contained in the current decade
millisecondsInHour
Section titled “millisecondsInHour”date.millisecondsInHour() → int
Return the number of milliseconds contained in the current hour
millisecondsInMillennium
Section titled “millisecondsInMillennium”date.millisecondsInMillennium() → int
Return the number of milliseconds contained in the current millennium
millisecondsInMinute
Section titled “millisecondsInMinute”date.millisecondsInMinute() → int
Return the number of milliseconds contained in the current minute
millisecondsInMonth
Section titled “millisecondsInMonth”date.millisecondsInMonth() → int
Return the number of milliseconds contained in the current month
millisecondsInQuarter
Section titled “millisecondsInQuarter”date.millisecondsInQuarter() → int
Return the number of milliseconds contained in the current quarter
millisecondsInSecond
Section titled “millisecondsInSecond”date.millisecondsInSecond() → int
Return the number of milliseconds contained in the current second
millisecondsInWeek
Section titled “millisecondsInWeek”date.millisecondsInWeek() → int
Return the number of milliseconds contained in the current week
millisecondsInYear
Section titled “millisecondsInYear”date.millisecondsInYear() → int
Return the number of milliseconds contained in the current year
millisecondsUntil
Section titled “millisecondsUntil”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.
minimum
Section titled “minimum”date.minimum(date?: Date) → Date
Get the minimum instance between a given instance (default now) and the current instance.
minute
Section titled “minute”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.
minuteOfCentury
Section titled “minuteOfCentury”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
minuteOfDay
Section titled “minuteOfDay”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
minuteOfDecade
Section titled “minuteOfDecade”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
minuteOfHour
Section titled “minuteOfHour”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
minuteOfMillennium
Section titled “minuteOfMillennium”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
minuteOfMonth
Section titled “minuteOfMonth”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
minuteOfQuarter
Section titled “minuteOfQuarter”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
minuteOfWeek
Section titled “minuteOfWeek”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
minuteOfYear
Section titled “minuteOfYear”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
minutes
Section titled “minutes”date.minutes(value: int) → Date
Set current instance minute to the given value.
minutesInCentury
Section titled “minutesInCentury”date.minutesInCentury() → int
Return the number of minutes contained in the current century
minutesInDay
Section titled “minutesInDay”date.minutesInDay() → int
Return the number of minutes contained in the current day
minutesInDecade
Section titled “minutesInDecade”date.minutesInDecade() → int
Return the number of minutes contained in the current decade
minutesInHour
Section titled “minutesInHour”date.minutesInHour() → int
Return the number of minutes contained in the current hour
minutesInMillennium
Section titled “minutesInMillennium”date.minutesInMillennium() → int
Return the number of minutes contained in the current millennium
minutesInMonth
Section titled “minutesInMonth”date.minutesInMonth() → int
Return the number of minutes contained in the current month
minutesInQuarter
Section titled “minutesInQuarter”date.minutesInQuarter() → int
Return the number of minutes contained in the current quarter
minutesInWeek
Section titled “minutesInWeek”date.minutesInWeek() → int
Return the number of minutes contained in the current week
minutesInYear
Section titled “minutesInYear”date.minutesInYear() → int
Return the number of minutes contained in the current year
minutesUntil
Section titled “minutesUntil”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.
modify
Section titled “modify”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.
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.
monthOfCentury
Section titled “monthOfCentury”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
monthOfDecade
Section titled “monthOfDecade”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
monthOfMillennium
Section titled “monthOfMillennium”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
monthOfQuarter
Section titled “monthOfQuarter”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
monthOfYear
Section titled “monthOfYear”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
months
Section titled “months”date.months(value: Month|int) → Date
Set current instance month to the given value.
monthsInCentury
Section titled “monthsInCentury”date.monthsInCentury() → int
Return the number of months contained in the current century
monthsInDecade
Section titled “monthsInDecade”date.monthsInDecade() → int
Return the number of months contained in the current decade
monthsInMillennium
Section titled “monthsInMillennium”date.monthsInMillennium() → int
Return the number of months contained in the current millennium
monthsInQuarter
Section titled “monthsInQuarter”date.monthsInQuarter() → int
Return the number of months contained in the current quarter
monthsInYear
Section titled “monthsInYear”date.monthsInYear() → int
Return the number of months contained in the current year
monthsUntil
Section titled “monthsUntil”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
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.
nextWeekday
Section titled “nextWeekday”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.
nextWeekendDay
Section titled “nextWeekendDay”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.
notEqualTo
Section titled “notEqualTo”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
nowWithSameTz
Section titled “nowWithSameTz”date.nowWithSameTz() → Date
Returns a present instance in the same timezone.
nthOfMonth
Section titled “nthOfMonth”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.
nthOfQuarter
Section titled “nthOfQuarter”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.
nthOfYear
Section titled “nthOfYear”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.
ordinal
Section titled “ordinal”date.ordinal(key: string, period?: string) → string
Return a property with its ordinal.
previous
Section titled “previous”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.
previousWeekday
Section titled “previousWeekday”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.
previousWeekendDay
Section titled “previousWeekendDay”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.
quarterOfCentury
Section titled “quarterOfCentury”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
quarterOfDecade
Section titled “quarterOfDecade”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
quarterOfMillennium
Section titled “quarterOfMillennium”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
quarterOfYear
Section titled “quarterOfYear”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
quartersInCentury
Section titled “quartersInCentury”date.quartersInCentury() → int
Return the number of quarters contained in the current century
quartersInDecade
Section titled “quartersInDecade”date.quartersInDecade() → int
Return the number of quarters contained in the current decade
quartersInMillennium
Section titled “quartersInMillennium”date.quartersInMillennium() → int
Return the number of quarters contained in the current millennium
quartersInYear
Section titled “quartersInYear”date.quartersInYear() → int
Return the number of quarters contained in the current year
quartersUntil
Section titled “quartersUntil”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).
rawAdd
Section titled “rawAdd”date.rawAdd(interval: DateInterval) → Date
Call native PHP DateTime/DateTimeImmutable add() method.
rawFormat
Section titled “rawFormat”date.rawFormat(format: string) → string
No description yet.
rawSub
Section titled “rawSub”date.rawSub(interval: DateInterval) → Date
Call native PHP DateTime/DateTimeImmutable sub() method.
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.
roundCenturies
Section titled “roundCenturies”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.
roundCentury
Section titled “roundCentury”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.
roundDay
Section titled “roundDay”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.
roundDays
Section titled “roundDays”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.
roundDecade
Section titled “roundDecade”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.
roundDecades
Section titled “roundDecades”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.
roundHour
Section titled “roundHour”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.
roundHours
Section titled “roundHours”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.
roundMicrosecond
Section titled “roundMicrosecond”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.
roundMicroseconds
Section titled “roundMicroseconds”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.
roundMillennia
Section titled “roundMillennia”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.
roundMillennium
Section titled “roundMillennium”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.
roundMillisecond
Section titled “roundMillisecond”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.
roundMilliseconds
Section titled “roundMilliseconds”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.
roundMinute
Section titled “roundMinute”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.
roundMinutes
Section titled “roundMinutes”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.
roundMonth
Section titled “roundMonth”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.
roundMonths
Section titled “roundMonths”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.
roundQuarter
Section titled “roundQuarter”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.
roundQuarters
Section titled “roundQuarters”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.
roundSecond
Section titled “roundSecond”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.
roundSeconds
Section titled “roundSeconds”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.
roundUnit
Section titled “roundUnit”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.
roundWeek
Section titled “roundWeek”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.
roundYear
Section titled “roundYear”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.
roundYears
Section titled “roundYears”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.
second
Section titled “second”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.
secondOfCentury
Section titled “secondOfCentury”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
secondOfDay
Section titled “secondOfDay”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
secondOfDecade
Section titled “secondOfDecade”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
secondOfHour
Section titled “secondOfHour”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
secondOfMillennium
Section titled “secondOfMillennium”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
secondOfMinute
Section titled “secondOfMinute”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
secondOfMonth
Section titled “secondOfMonth”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
secondOfQuarter
Section titled “secondOfQuarter”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
secondOfWeek
Section titled “secondOfWeek”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
secondOfYear
Section titled “secondOfYear”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
seconds
Section titled “seconds”date.seconds(value: int) → Date
Set current instance second to the given value.
secondsInCentury
Section titled “secondsInCentury”date.secondsInCentury() → int
Return the number of seconds contained in the current century
secondsInDay
Section titled “secondsInDay”date.secondsInDay() → int
Return the number of seconds contained in the current day
secondsInDecade
Section titled “secondsInDecade”date.secondsInDecade() → int
Return the number of seconds contained in the current decade
secondsInHour
Section titled “secondsInHour”date.secondsInHour() → int
Return the number of seconds contained in the current hour
secondsInMillennium
Section titled “secondsInMillennium”date.secondsInMillennium() → int
Return the number of seconds contained in the current millennium
secondsInMinute
Section titled “secondsInMinute”date.secondsInMinute() → int
Return the number of seconds contained in the current minute
secondsInMonth
Section titled “secondsInMonth”date.secondsInMonth() → int
Return the number of seconds contained in the current month
secondsInQuarter
Section titled “secondsInQuarter”date.secondsInQuarter() → int
Return the number of seconds contained in the current quarter
secondsInWeek
Section titled “secondsInWeek”date.secondsInWeek() → int
Return the number of seconds contained in the current week
secondsInYear
Section titled “secondsInYear”date.secondsInYear() → int
Return the number of seconds contained in the current year
secondsSinceMidnight
Section titled “secondsSinceMidnight”date.secondsSinceMidnight() → float
The number of seconds since midnight.
secondsUntil
Section titled “secondsUntil”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.
secondsUntilEndOfDay
Section titled “secondsUntilEndOfDay”date.secondsUntilEndOfDay() → float
The number of seconds until 23:59:59.
serialize
Section titled “serialize”date.serialize() → string
Return a serialized string of the instance.
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.
setDate
Section titled “setDate”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.
setDateFrom
Section titled “setDateFrom”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.
setDateTime
Section titled “setDateTime”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.
setDateTimeFrom
Section titled “setDateTimeFrom”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.
setDay
Section titled “setDay”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.
setDays
Section titled “setDays”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.
setDaysFromStartOfWeek
Section titled “setDaysFromStartOfWeek”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.
setHour
Section titled “setHour”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.
setHours
Section titled “setHours”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.
setISODate
Section titled “setISODate”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.
setMicro
Section titled “setMicro”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.
setMicros
Section titled “setMicros”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.
setMicrosecond
Section titled “setMicrosecond”date.setMicrosecond(microsecond: int) → Date
Changes this date in place and returns it. Use date.copy() first to keep the original.
setMicroseconds
Section titled “setMicroseconds”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.
setMilli
Section titled “setMilli”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.
setMillis
Section titled “setMillis”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.
setMillisecond
Section titled “setMillisecond”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.
setMilliseconds
Section titled “setMilliseconds”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.
setMinute
Section titled “setMinute”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.
setMinutes
Section titled “setMinutes”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.
setMonth
Section titled “setMonth”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.
setMonths
Section titled “setMonths”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.
setSecond
Section titled “setSecond”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.
setSeconds
Section titled “setSeconds”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.
setTime
Section titled “setTime”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.
setTimeFrom
Section titled “setTimeFrom”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.
setTimeFromTimeString
Section titled “setTimeFromTimeString”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.
setTimestamp
Section titled “setTimestamp”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.
setTimezone
Section titled “setTimezone”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.
setUnit
Section titled “setUnit”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.
setUnitNoOverflow
Section titled “setUnitNoOverflow”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.
setYear
Section titled “setYear”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.
setYears
Section titled “setYears”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.
shiftTimezone
Section titled “shiftTimezone”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.
shortAbsoluteDiffForHumans
Section titled “shortAbsoluteDiffForHumans”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.)
shortRelativeDiffForHumans
Section titled “shortRelativeDiffForHumans”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.)
shortRelativeToNowDiffForHumans
Section titled “shortRelativeToNowDiffForHumans”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.)
shortRelativeToOtherDiffForHumans
Section titled “shortRelativeToOtherDiffForHumans”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.
startOf
Section titled “startOf”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);
startOfCentury
Section titled “startOfCentury”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();
startOfDay
Section titled “startOfDay”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();
startOfDecade
Section titled “startOfDecade”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();
startOfHour
Section titled “startOfHour”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();
startOfMillennium
Section titled “startOfMillennium”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();
startOfMillisecond
Section titled “startOfMillisecond”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’);
startOfMinute
Section titled “startOfMinute”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();
startOfMonth
Section titled “startOfMonth”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();
startOfQuarter
Section titled “startOfQuarter”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();
startOfSecond
Section titled “startOfSecond”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’);
startOfWeek
Section titled “startOfWeek”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”;
startOfYear
Section titled “startOfYear”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();
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))subCenturies
Section titled “subCenturies”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.
subCenturiesNoOverflow
Section titled “subCenturiesNoOverflow”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.
subCenturiesWithNoOverflow
Section titled “subCenturiesWithNoOverflow”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.
subCenturiesWithOverflow
Section titled “subCenturiesWithOverflow”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.
subCenturiesWithoutOverflow
Section titled “subCenturiesWithoutOverflow”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.
subCentury
Section titled “subCentury”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.
subCenturyNoOverflow
Section titled “subCenturyNoOverflow”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.
subCenturyWithNoOverflow
Section titled “subCenturyWithNoOverflow”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.
subCenturyWithOverflow
Section titled “subCenturyWithOverflow”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.
subCenturyWithoutOverflow
Section titled “subCenturyWithoutOverflow”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.
subDay
Section titled “subDay”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.
subDays
Section titled “subDays”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.
subDecade
Section titled “subDecade”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.
subDecadeNoOverflow
Section titled “subDecadeNoOverflow”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.
subDecadeWithNoOverflow
Section titled “subDecadeWithNoOverflow”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.
subDecadeWithOverflow
Section titled “subDecadeWithOverflow”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.
subDecadeWithoutOverflow
Section titled “subDecadeWithoutOverflow”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.
subDecades
Section titled “subDecades”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.
subDecadesNoOverflow
Section titled “subDecadesNoOverflow”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.
subDecadesWithNoOverflow
Section titled “subDecadesWithNoOverflow”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.
subDecadesWithOverflow
Section titled “subDecadesWithOverflow”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.
subDecadesWithoutOverflow
Section titled “subDecadesWithoutOverflow”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.
subHour
Section titled “subHour”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.
subHours
Section titled “subHours”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.
subMicro
Section titled “subMicro”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.
subMicros
Section titled “subMicros”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.
subMicrosecond
Section titled “subMicrosecond”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.
subMicroseconds
Section titled “subMicroseconds”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.
subMillennia
Section titled “subMillennia”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.
subMillenniaNoOverflow
Section titled “subMillenniaNoOverflow”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.
subMillenniaWithNoOverflow
Section titled “subMillenniaWithNoOverflow”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.
subMillenniaWithOverflow
Section titled “subMillenniaWithOverflow”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.
subMillenniaWithoutOverflow
Section titled “subMillenniaWithoutOverflow”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.
subMillennium
Section titled “subMillennium”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.
subMillenniumNoOverflow
Section titled “subMillenniumNoOverflow”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.
subMillenniumWithNoOverflow
Section titled “subMillenniumWithNoOverflow”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.
subMillenniumWithOverflow
Section titled “subMillenniumWithOverflow”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.
subMillenniumWithoutOverflow
Section titled “subMillenniumWithoutOverflow”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.
subMilli
Section titled “subMilli”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.
subMillis
Section titled “subMillis”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.
subMillisecond
Section titled “subMillisecond”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.
subMilliseconds
Section titled “subMilliseconds”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.
subMinute
Section titled “subMinute”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.
subMinutes
Section titled “subMinutes”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.
subMonth
Section titled “subMonth”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.
subMonthNoOverflow
Section titled “subMonthNoOverflow”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.
subMonthWithNoOverflow
Section titled “subMonthWithNoOverflow”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.
subMonthWithOverflow
Section titled “subMonthWithOverflow”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.
subMonthWithoutOverflow
Section titled “subMonthWithoutOverflow”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.
subMonths
Section titled “subMonths”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.
subMonthsNoOverflow
Section titled “subMonthsNoOverflow”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.
subMonthsWithNoOverflow
Section titled “subMonthsWithNoOverflow”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.
subMonthsWithOverflow
Section titled “subMonthsWithOverflow”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.
subMonthsWithoutOverflow
Section titled “subMonthsWithoutOverflow”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.
subQuarter
Section titled “subQuarter”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.
subQuarterNoOverflow
Section titled “subQuarterNoOverflow”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.
subQuarterWithNoOverflow
Section titled “subQuarterWithNoOverflow”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.
subQuarterWithOverflow
Section titled “subQuarterWithOverflow”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.
subQuarterWithoutOverflow
Section titled “subQuarterWithoutOverflow”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.
subQuarters
Section titled “subQuarters”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.
subQuartersNoOverflow
Section titled “subQuartersNoOverflow”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.
subQuartersWithNoOverflow
Section titled “subQuartersWithNoOverflow”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.
subQuartersWithOverflow
Section titled “subQuartersWithOverflow”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.
subQuartersWithoutOverflow
Section titled “subQuartersWithoutOverflow”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.
subRealUnit
Section titled “subRealUnit”date.subRealUnit(unit: mixed, value?: int = 1) → Date
Changes this date in place and returns it. Use date.copy() first to keep the original.
subSecond
Section titled “subSecond”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.
subSeconds
Section titled “subSeconds”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.
subUTCCenturies
Section titled “subUTCCenturies”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.
subUTCCentury
Section titled “subUTCCentury”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.
subUTCDay
Section titled “subUTCDay”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.
subUTCDays
Section titled “subUTCDays”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.
subUTCDecade
Section titled “subUTCDecade”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.
subUTCDecades
Section titled “subUTCDecades”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.
subUTCHour
Section titled “subUTCHour”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.
subUTCHours
Section titled “subUTCHours”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.
subUTCMicro
Section titled “subUTCMicro”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.
subUTCMicros
Section titled “subUTCMicros”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.
subUTCMicrosecond
Section titled “subUTCMicrosecond”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.
subUTCMicroseconds
Section titled “subUTCMicroseconds”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.
subUTCMillennia
Section titled “subUTCMillennia”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.
subUTCMillennium
Section titled “subUTCMillennium”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.
subUTCMilli
Section titled “subUTCMilli”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.
subUTCMillis
Section titled “subUTCMillis”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.
subUTCMillisecond
Section titled “subUTCMillisecond”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.
subUTCMilliseconds
Section titled “subUTCMilliseconds”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.
subUTCMinute
Section titled “subUTCMinute”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.
subUTCMinutes
Section titled “subUTCMinutes”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.
subUTCMonth
Section titled “subUTCMonth”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.
subUTCMonths
Section titled “subUTCMonths”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.
subUTCQuarter
Section titled “subUTCQuarter”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.
subUTCQuarters
Section titled “subUTCQuarters”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.
subUTCSecond
Section titled “subUTCSecond”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.
subUTCSeconds
Section titled “subUTCSeconds”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.
subUTCUnit
Section titled “subUTCUnit”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.
subUTCWeek
Section titled “subUTCWeek”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.
subUTCWeeks
Section titled “subUTCWeeks”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.
subUTCYear
Section titled “subUTCYear”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.
subUTCYears
Section titled “subUTCYears”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.
subUnit
Section titled “subUnit”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.
subUnitNoOverflow
Section titled “subUnitNoOverflow”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.
subWeek
Section titled “subWeek”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.
subWeekday
Section titled “subWeekday”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.
subWeekdays
Section titled “subWeekdays”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.
subWeeks
Section titled “subWeeks”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.
subYear
Section titled “subYear”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.
subYearNoOverflow
Section titled “subYearNoOverflow”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.
subYearWithNoOverflow
Section titled “subYearWithNoOverflow”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.
subYearWithOverflow
Section titled “subYearWithOverflow”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.
subYearWithoutOverflow
Section titled “subYearWithoutOverflow”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.
subYears
Section titled “subYears”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.
subYearsNoOverflow
Section titled “subYearsNoOverflow”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.
subYearsWithNoOverflow
Section titled “subYearsWithNoOverflow”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.
subYearsWithOverflow
Section titled “subYearsWithOverflow”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.
subYearsWithoutOverflow
Section titled “subYearsWithoutOverflow”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.
subtract
Section titled “subtract”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.
timespan
Section titled “timespan”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).
timestamp
Section titled “timestamp”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.
timezone
Section titled “timezone”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
toArray
Section titled “toArray”date.toArray() → array
Get default array representation.
var_dump(Carbon::now()->toArray());
toAtomString
Section titled “toAtomString”date.toAtomString() → string
Format the instance as ATOM
echo Carbon::now()->toAtomString();
toCookieString
Section titled “toCookieString”date.toCookieString() → string
Format the instance as COOKIE
echo Carbon::now()->toCookieString();
toDate
Section titled “toDate”date.toDate() → DateTime
No description yet.
var_dump(Carbon::now()->toDate());
toDateString
Section titled “toDateString”date.toDateString() → string
Format the instance as date
echo Carbon::now()->toDateString();
toDateTime
Section titled “toDateTime”date.toDateTime() → DateTime
Return native DateTime PHP object matching the current instance.
var_dump(Carbon::now()->toDateTime());
toDateTimeImmutable
Section titled “toDateTimeImmutable”date.toDateTimeImmutable() → DateTimeImmutable
Return native toDateTimeImmutable PHP object matching the current instance.
var_dump(Carbon::now()->toDateTimeImmutable());
toDateTimeLocalString
Section titled “toDateTimeLocalString”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
toDateTimeString
Section titled “toDateTimeString”date.toDateTimeString(unitPrecision?: string = "second") → string
Format the instance as date and time
echo Carbon::now()->toDateTimeString();
toDayDateTimeString
Section titled “toDayDateTimeString”date.toDayDateTimeString() → string
Format the instance with day, date and time
echo Carbon::now()->toDayDateTimeString();
toFormattedDateString
Section titled “toFormattedDateString”date.toFormattedDateString() → string
Format the instance as a readable date
echo Carbon::now()->toFormattedDateString();
toFormattedDayDateString
Section titled “toFormattedDayDateString”date.toFormattedDayDateString() → string
Format the instance with the day, and a readable date
echo Carbon::now()->toFormattedDayDateString();
toISOString
Section titled “toISOString”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”;
toImmutable
Section titled “toImmutable”date.toImmutable() → CarbonImmutable
Return a immutable copy of the instance.
toIso8601String
Section titled “toIso8601String”date.toIso8601String() → string
Format the instance as ISO8601
echo Carbon::now()->toIso8601String();
toIso8601ZuluString
Section titled “toIso8601ZuluString”date.toIso8601ZuluString(unitPrecision?: string = "second") → string
Convert the instance to UTC and return as Zulu ISO8601
echo Carbon::now()->toIso8601ZuluString();
toJSON
Section titled “toJSON”date.toJSON() → string
Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.
echo Carbon::now(‘America/Toronto’)->toJSON();
toMutable
Section titled “toMutable”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
toObject
Section titled “toObject”date.toObject() → object
Get default object representation.
var_dump(Carbon::now()->toObject());
toPeriod
Section titled “toPeriod”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).
toRfc1036String
Section titled “toRfc1036String”date.toRfc1036String() → string
Format the instance as RFC1036
echo Carbon::now()->toRfc1036String();
toRfc1123String
Section titled “toRfc1123String”date.toRfc1123String() → string
Format the instance as RFC1123
echo Carbon::now()->toRfc1123String();
toRfc2822String
Section titled “toRfc2822String”date.toRfc2822String() → string
Format the instance as RFC2822
echo Carbon::now()->toRfc2822String();
toRfc3339String
Section titled “toRfc3339String”date.toRfc3339String(extended?: bool = false) → string
Format the instance as RFC3339.
echo Carbon::now()->toRfc3339String() . “\n”; echo Carbon::now()->toRfc3339String(true) . “\n”;
toRfc7231String
Section titled “toRfc7231String”date.toRfc7231String() → string
Format the instance as RFC7231
echo Carbon::now()->toRfc7231String();
toRfc822String
Section titled “toRfc822String”date.toRfc822String() → string
Format the instance as RFC822
echo Carbon::now()->toRfc822String();
toRfc850String
Section titled “toRfc850String”date.toRfc850String() → string
Format the instance as RFC850
echo Carbon::now()->toRfc850String();
toRssString
Section titled “toRssString”date.toRssString() → string
Format the instance as RSS
echo Carbon::now()->toRssString();
toString
Section titled “toString”date.toString() → string
Returns english human-readable complete date string.
echo Carbon::now()->toString();
toTimeString
Section titled “toTimeString”date.toTimeString(unitPrecision?: string = "second") → string
Format the instance as time
echo Carbon::now()->toTimeString();
toW3cString
Section titled “toW3cString”date.toW3cString() → string
Format the instance as W3C
echo Carbon::now()->toW3cString();
translate
Section titled “translate”date.translate(key: string, parameters?: array = [], number?: string, translator?: TranslatorInterface, altNumbers?: bool = false) → string
Translate using translation string or callback available.
translateNumber
Section titled “translateNumber”date.translateNumber(number: int) → string
Returns the alternative number for a given integer if available in the current locale.
translateTimeStringTo
Section titled “translateTimeStringTo”date.translateTimeStringTo(timeString: string, to?: string) → string
Translate a time string from the current locale ($date->locale()) to another one.
translatedFormat
Section titled “translatedFormat”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.
utcOffset
Section titled “utcOffset”date.utcOffset(minuteOffset?: int) → Date
Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.
valueOf
Section titled “valueOf”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).
weekOfCentury
Section titled “weekOfCentury”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
weekOfDecade
Section titled “weekOfDecade”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
weekOfMillennium
Section titled “weekOfMillennium”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
weekOfMonth
Section titled “weekOfMonth”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
weekOfQuarter
Section titled “weekOfQuarter”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
weekOfYear
Section titled “weekOfYear”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
weekYear
Section titled “weekYear”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).
weekday
Section titled “weekday”date.weekday(value?: WeekDay) → Date
Get/set the weekday from 0 (Sunday) to 6 (Saturday).
weeksInCentury
Section titled “weeksInCentury”date.weeksInCentury() → int
Return the number of weeks contained in the current century
weeksInDecade
Section titled “weeksInDecade”date.weeksInDecade() → int
Return the number of weeks contained in the current decade
weeksInMillennium
Section titled “weeksInMillennium”date.weeksInMillennium() → int
Return the number of weeks contained in the current millennium
weeksInMonth
Section titled “weeksInMonth”date.weeksInMonth() → int
Return the number of weeks contained in the current month
weeksInQuarter
Section titled “weeksInQuarter”date.weeksInQuarter() → int
Return the number of weeks contained in the current quarter
weeksInYear
Section titled “weeksInYear”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).
weeksUntil
Section titled “weeksUntil”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.
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.
yearOfCentury
Section titled “yearOfCentury”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
yearOfDecade
Section titled “yearOfDecade”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
yearOfMillennium
Section titled “yearOfMillennium”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.
yearsInCentury
Section titled “yearsInCentury”date.yearsInCentury() → int
Return the number of years contained in the current century
yearsInDecade
Section titled “yearsInDecade”date.yearsInDecade() → int
Return the number of years contained in the current decade
yearsInMillennium
Section titled “yearsInMillennium”date.yearsInMillennium() → int
Return the number of years contained in the current millennium
yearsUntil
Section titled “yearsUntil”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.