bool
Returns true if the current class/instance is mutable.
Method added | 2.0.0 | no arguments |
DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time = null, DateTimeZone|string|int|null $timezone = null
Create a new Carbon instance.
Please see the testing aids section (specifically static::setTestNow())
for more on the possibility of this constructor returning a test instance.
Prototype changed | 3.0.0 | DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time = null, DateTimeZone|string|int|null $timezone = null |
Method added | 1.0.0 | $time = null, $tz = null |
array
Returns the values to dump on serialize() called on.
Only used by PHP >= 7.4.
Method added | 1.21.0 | no arguments |
array $data
Set locale if specified on unserialize() called.
Only used by PHP >= 7.4.
Method added | 1.21.0 | array $data |
Set locale if specified on unserialize() called.
Only used by PHP < 7.4.
Method added | 1.0.0 | no arguments |
$dump
Carbon
The __set_state handler.
Prototype changed | 2.0.0 | $dump |
Prototype changed | 1.24.2 | $array |
Prototype changed | 1.24.1 | $state |
Prototype changed | 1.24.0 | array $state |
Prototype changed | 1.23.0 | $array |
Method added | 1.0.0 | array $array |
DateTime
$format, $time, $timezone = null
Carbon
Create a Carbon instance from a specific format.
Prototype changed | 3.0.0 | $format, $time, $timezone = null |
Prototype changed | 1.3.0 | $format, $time, $tz = null |
Method added | 1.0.0 | $format, $time, $object = null |
array|false
{@inheritdoc}
Method added | 1.0.0 | no arguments |
string $format
string
Returns the formatted date string on success or FALSE on failure.
Prototype changed | 3.0.0 | string $format |
Prototype changed | 2.16.0 | $format |
Prototype changed | 1.21.0 | string $format |
Method added | 1.0.0 | $format |
$modify
Carbon
Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else.
Prototype changed | 2.23.0 | $modify |
Prototype changed | 1.23.0 | string $modifier |
Prototype changed | 1.22.0 | $modify |
Prototype changed | 1.21.0 | string $modifier |
Method added | 1.0.0 | $modify |
$unit, $value = 1, ?bool $overflow = null
Carbon
Add given units or interval to the current instance.
Examples:
$date->add('hour', 3)
$date->add(15, 'days')
$date->add(CarbonInterval::days(4))
Prototype changed | 3.0.0 | $unit, $value = 1, ?bool $overflow = null |
Prototype changed | 2.0.0 | $unit, $value = 1, $overflow = null |
Prototype changed | 1.21.0 | DateInterval $interval |
Method added | 1.0.0 | $interval |
$unit, $value = 1, ?bool $overflow = null
Carbon
Subtract given units or interval to the current instance.
Examples:
$date->sub('hour', 3)
$date->sub(15, 'days')
$date->sub(CarbonInterval::days(4))
Prototype changed | 3.0.0 | $unit, $value = 1, ?bool $overflow = null |
Prototype changed | 2.0.0 | $unit, $value = 1, $overflow = null |
Prototype changed | 1.21.0 | DateInterval $interval |
Method added | 1.0.0 | $interval |
CarbonTimeZone
Get the TimeZone associated with the Carbon instance (as CarbonTimeZone).
Method added | 1.0.0 | no arguments |
DateTimeZone|string|int $timeZone
Carbon
Set the instance's timezone from a string or object.
Prototype changed | 3.0.0 | DateTimeZone|string|int $timeZone |
Method added | 1.0.0 | $value |
int $hour, int $minute, int $second = 0, int $microseconds = 0
Carbon
Resets the current time of the DateTime object to a different time.
Prototype changed | 3.0.0 | int $hour, int $minute, int $second = 0, int $microseconds = 0 |
Prototype changed | 2.23.0 | $hour, $minute, $second = 0, $microseconds = 0 |
Prototype changed | 1.21.0 | int $hour, int $minute, int $second = 0, int $microsecond = 0 |
Prototype changed | 1.15.0 | $hour, $minute, $second, $microseconds |
Method added | 1.0.0 | $hour, $minute, $second = 0 |
int $year, int $month, int $day
Carbon
Set the date with gregorian year, month and day numbers.
Prototype changed | 3.0.0 | int $year, int $month, int $day |
Prototype changed | 2.23.0 | $year, $month, $day |
Prototype changed | 2.0.0 | int $year, int $month, int $day |
Prototype changed | 1.22.0 | $year, $month, $day |
Prototype changed | 1.21.0 | int $year, int $month, int $day |
Method added | 1.0.0 | $year, $month, $day |
int $year, int $week, int $day = 1
Carbon
Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
Prototype changed | 3.0.0 | int $year, int $week, int $day = 1 |
Prototype changed | 2.23.0 | $year, $week, $day = 1 |
Prototype changed | 1.21.0 | int $year, int $week, int $dayOfWeek = 1 |
Method added | 1.0.0 | $year, $week, $day |
string|int|float $timestamp
Carbon
Set the instance's timestamp.
Timestamp input can be given as int, float or a string containing one or more numbers.
Prototype changed | 3.0.0 | string|int|float $timestamp |
Prototype changed | 2.41.0 | $unixTimestamp |
Prototype changed | 2.23.0 | $unixtimestamp |
Prototype changed | 1.21.0 | int $timestamp |
Method added | 1.0.0 | $unixtimestamp |
$date = null, bool $absolute = false, array $skip = []
CarbonInterval
@alias diffAsCarbonInterval
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).
Prototype changed | 3.0.0 | $date = null, bool $absolute = false, array $skip = [] |
Prototype changed | 2.23.0 | $date = null, $absolute = false |
Prototype changed | 1.21.0 | DateTimeInterface $targetObject, bool $absolute = false |
Method added | 1.0.0 | $object, $absolute |
Carbon
Get a copy of the instance.
Method added | 1.0.0 | no arguments |
Carbon
@alias copy
Get a copy of the instance.
Method added | 2.0.0 | no arguments |
Carbon
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.
Method added | 2.50.0 | no arguments |
Carbon
Returns a present instance in the same timezone.
Method added | 1.24.0 | no arguments |
$date = null
Carbon
Return the Carbon instance passed through, a now instance in the same timezone if null given or parse the input if string given.
Method added | 2.23.0 | $date = null |
string $name
mixed
Get a part of the Carbon object.
Prototype changed | 3.0.0 | string $name |
Method added | 1.0.0 | $name |
Carbon\Unit|string $name
mixed
Get a part of the Carbon object.
Prototype changed | 3.1.0 | Carbon\Unit|string $name |
Prototype changed | 3.0.0 | string $name |
Method added | 2.0.0 | $name |
$name
bool
Check if an attribute exists on the object
Method added | 1.2.0 | $name |
$name, $value
Set a part of the Carbon object
Method added | 1.0.0 | $name, $value |
Carbon\Unit|array|string $name, DateTimeZone|Carbon\Month|string|int|float|null $value = null
Carbon
Set a part of the Carbon object.
Prototype changed | 3.1.0 | Carbon\Unit|array|string $name, DateTimeZone|Carbon\Month|string|int|float|null $value = null |
Prototype changed | 3.0.0 | array|string $name, DateTimeZone|Carbon\Month|string|int|float|null $value = null |
Method added | 2.0.0 | $name, $value = null |
?string $context = null, string $keySuffix = '', ?string $defaultValue = null
string
Get the translation of the current week day name (with context for languages with multiple forms).
Prototype changed | 3.0.0 | ?string $context = null, string $keySuffix = '', ?string $defaultValue = null |
Method added | 2.4.0 | $context = null, $keySuffix = '', $defaultValue = null |
?string $context = null
string
Get the translation of the current short week day name (with context for languages with multiple forms).
Prototype changed | 3.0.0 | ?string $context = null |
Method added | 2.4.0 | $context = null |
?string $context = null
string
Get the translation of the current abbreviated week day name (with context for languages with multiple forms).
Prototype changed | 3.0.0 | ?string $context = null |
Method added | 2.4.0 | $context = null |
?string $context = null, string $keySuffix = '', ?string $defaultValue = null
string
Get the translation of the current month day name (with context for languages with multiple forms).
Prototype changed | 3.0.0 | ?string $context = null, string $keySuffix = '', ?string $defaultValue = null |
Method added | 2.4.0 | $context = null, $keySuffix = '', $defaultValue = null |
?string $context = null
string
Get the translation of the current short month day name (with context for languages with multiple forms).
Prototype changed | 3.0.0 | ?string $context = null |
Method added | 2.4.0 | $context = null |
?int $value = null
Carbon|int
Get/set the day of year.
Prototype changed | 3.0.0 | ?int $value = null |
Method added | 2.0.0 | $value = null |
Carbon\WeekDay|int|null $value = null
Carbon|int
Get/set the weekday from 0 (Sunday) to 6 (Saturday).
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $value = null |
Method added | 2.0.0 | $value = null |
Carbon\WeekDay|int|null $value = null
Carbon|int
Get/set the ISO weekday from 1 (Monday) to 7 (Sunday).
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $value = null |
Method added | 2.0.0 | $value = null |
Carbon\WeekDay|int|null $weekStartsAt = null
int
Return the number of days since the start of the week (using the current locale or the first parameter if explicitly given).
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekStartsAt = null |
Method added | 2.64.0 | ?int $weekStartsAt = null |
int $numberOfDays, Carbon\WeekDay|int|null $weekStartsAt = null
Carbon
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.
Prototype changed | 3.0.0 | int $numberOfDays, Carbon\WeekDay|int|null $weekStartsAt = null |
Method added | 2.64.0 | int $numberOfDays, ?int $weekStartsAt = null |
string $valueUnit, int $value, string $overflowUnit
Carbon
Set any unit to a new value without overflowing current other unit given.
Prototype changed | 3.0.0 | string $valueUnit, int $value, string $overflowUnit |
Method added | 2.0.0 | $valueUnit, $value, $overflowUnit |
string $valueUnit, int $value, string $overflowUnit
Carbon
Add any unit to a new value without overflowing current other unit given.
Prototype changed | 3.0.0 | string $valueUnit, int $value, string $overflowUnit |
Method added | 2.0.0 | $valueUnit, $value, $overflowUnit |
string $valueUnit, int $value, string $overflowUnit
Carbon
Subtract any unit to a new value without overflowing current other unit given.
Prototype changed | 3.0.0 | string $valueUnit, int $value, string $overflowUnit |
Method added | 2.0.0 | $valueUnit, $value, $overflowUnit |
?int $minuteOffset = null
Carbon|int
Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.
Prototype changed | 2.44.0 | ?int $minuteOffset = null |
Method added | 2.0.0 | ?int $offset = null |
int $year, int $month, int $day, int $hour, int $minute, int $second = 0, int $microseconds = 0
Carbon
Set the date and time all together.
Prototype changed | 3.0.0 | int $year, int $month, int $day, int $hour, int $minute, int $second = 0, int $microseconds = 0 |
Prototype changed | 2.0.0 | $year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0 |
Prototype changed | 1.12.0 | $year, $month, $day, $hour, $minute, $second = 0 |
Method added | 1.0.0 | $year, $month, $day, $hour, $minute, $second |
string $time
Carbon
Set the time by time string.
Prototype changed | 3.0.0 | string $time |
Method added | 1.21.0 | $time |
DateTimeZone|string|int $value
Carbon
@alias setTimezone
Prototype changed | 3.0.0 | DateTimeZone|string|int $value |
Method added | 1.0.0 | $value |
DateTimeZone|string|int|null $value = null
Carbon|string
Set the timezone or returns the timezone name if no arguments passed.
Prototype changed | 3.0.0 | DateTimeZone|string|int|null $value = null |
Prototype changed | 2.0.0 | $value = null |
Method added | 1.0.0 | $value |
DateTimeZone|string $value
Carbon
Set the instance's timezone from a string or object and add/subtract the offset difference.
Prototype changed | 3.0.0 | DateTimeZone|string $value |
Method added | 2.0.0 | $value |
Carbon
Set the instance's timezone to UTC.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
Carbon
Set the year, month, and date for this instance to that of the passed instance.
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 2.0.0 | $date = null |
Method added | 1.26.0 | $date |
DateTimeInterface|string $date
Carbon
Set the hour, minute, second and microseconds for this instance to that of the passed instance.
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 2.0.0 | $date = null |
Method added | 1.26.0 | $date |
DateTimeInterface|string $date
Carbon
Set the date and time for this instance to that of the passed instance.
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Method added | 2.0.0 | $date = null |
array
Get the days of the week.
Method added | 1.23.0 | no arguments |
?string $locale = null
int
Get the first day of week.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 1.20.0 | no arguments |
?string $locale = null
int
Get the last day of week.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 1.20.0 | no arguments |
array
Get weekend days
Method added | 1.20.0 | no arguments |
array $days
Examples:
Carbon::macro('isDayOff', function ($date) {
return $date->isSunday() || $date->isMonday();
});
Carbon::macro('isNotDayOff', function ($date) {
return !$date->isDayOff();
});
if ($someDate->isDayOff()) ...
if ($someDate->isNotDayOff()) ...
// Add 5 not-off days
$count = 5;
while ($someDate->isDayOff() || ($count-- > 0)) {
$someDate->addDay();
}
Prototype changed | 3.0.0 | array $days |
Method added | 1.20.0 | $days |
?string $time
bool
Determine if a time string will produce a relative date.
Prototype changed | 3.0.0 | ?string $time |
Method added | 1.4.0 | $time |
?string $locale = null
array
Returns list of locale formats for ISO formatting.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 2.0.0 | $locale = null |
?string $locale = null
array
Returns list of calendar formats for ISO formatting.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 2.0.0 | $locale = null |
array
Returns list of locale units for ISO formatting.
Method added | 2.0.0 | no arguments |
$unit, $length = 2, $padString = '0', $padType = 0
string
Returns a unit of the instance padded with 0 by default or any other string if specified.
Method added | 2.0.0 | $unit, $length = 2, $padString = '0', $padType = 0 |
string $key, ?string $period = null
string
Return a property with its ordinal.
Method added | 2.0.0 | string $key, ?string $period = null |
bool $isLower = false
string
Return the meridiem of the current time in the current locale.
Method added | 2.14.0 | bool $isLower = false |
string $key
string
Returns the alternative number for a given date property if available in the current locale.
Method added | 2.14.0 | string $key |
string $format, ?string $originalFormat = null
string
Format in the current language using ISO replacement patterns.
Prototype changed | 2.16.0 | string $format, ?string $originalFormat = null |
Method added | 2.0.0 | string $format |
array
List of replacements from date() format to isoFormat().
Method added | 2.16.0 | no arguments |
string $format
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.
Method added | 2.16.0 | string $format |
string $separator = ':'
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".
Prototype changed | 3.0.0 | string $separator = ':' |
Method added | 2.0.0 | $separator = ':' |
string $unit, Carbon\Month|int|float|null $value = null
Carbon
Set specified unit to new given value.
Prototype changed | 3.0.0 | string $unit, Carbon\Month|int|float|null $value = null |
Method added | 2.0.0 | $unit, $value = null |
string $unit
string
Returns standardized singular of a given singular/plural unit name (in English).
Method added | 2.0.0 | string $unit |
string $unit
string
Returns standardized plural of a given singular/plural unit name (in English).
Method added | 2.0.0 | string $unit |
int|float $seconds
Method added | 3.0.0 | int|float $seconds |
Carbon
Resets the time to 00:00:00 start of day
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfDay();
Method added | 1.0.0 | no arguments |
Carbon
Resets the time to 23:59:59.999999 end of day
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfDay();
Method added | 1.0.0 | no arguments |
Carbon
Resets the date to the first day of the month and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth();
Method added | 1.0.0 | no arguments |
Carbon
Resets the date to end of the month and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth();
Method added | 1.0.0 | no arguments |
Carbon
Resets the date to the first day of the quarter and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter();
Method added | 1.22.0 | no arguments |
Carbon
Resets the date to end of the quarter and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter();
Method added | 1.22.0 | no arguments |
Carbon
Resets the date to the first day of the year and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfYear();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to end of the year and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfYear();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to the first day of the decade and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to end of the decade and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to the first day of the century and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to end of the century and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury();
Method added | 1.7.0 | no arguments |
Carbon
Resets the date to the first day of the millennium and the time to 00:00:00
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium();
Method added | 1.39.0 | no arguments |
Carbon
Resets the date to end of the millennium and time to 23:59:59.999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium();
Method added | 1.39.0 | no arguments |
Carbon\WeekDay|int|null $weekStartsAt = null
Carbon
Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00
Examples:
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";
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekStartsAt = null |
Prototype changed | 2.0.0 | $weekStartsAt = null |
Method added | 1.3.0 | no arguments |
Carbon\WeekDay|int|null $weekEndsAt = null
Carbon
Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999
Examples:
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";
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekEndsAt = null |
Prototype changed | 2.0.0 | $weekEndsAt = null |
Method added | 1.3.0 | no arguments |
Carbon
Modify to start of current hour, minutes and seconds become 0
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfHour();
Method added | 1.24.0 | no arguments |
Carbon
Modify to end of current hour, minutes and seconds become 59
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfHour();
Method added | 1.24.0 | no arguments |
Carbon
Modify to start of current minute, seconds become 0
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute();
Method added | 1.24.0 | no arguments |
Carbon
Modify to end of current minute, seconds become 59
Examples:
echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute();
Method added | 1.24.0 | no arguments |
Carbon
Modify to start of current second, microseconds become 0
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->startOfSecond()
->format('H:i:s.u');
Method added | 1.33.0 | no arguments |
Carbon
Modify to end of current second, microseconds become 999999
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->endOfSecond()
->format('H:i:s.u');
Method added | 1.33.0 | no arguments |
Carbon
Modify to start of current millisecond, microseconds such as 12345 become 123000
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->startOfSecond()
->format('H:i:s.u');
Method added | 3.8.0 | no arguments |
Carbon
Modify to end of current millisecond, microseconds such as 12345 become 123999
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->endOfSecond()
->format('H:i:s.u');
Method added | 3.8.0 | no arguments |
Carbon\Unit|string $unit, mixed $params
Carbon
Modify to start of current given unit.
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->startOf(Unit::Month)
->endOf(Unit::Week, Carbon::FRIDAY);
Prototype changed | 3.8.0 | Carbon\Unit|string $unit, mixed $params |
Prototype changed | 3.0.0 | string $unit, mixed $params |
Method added | 2.0.0 | $unit, $params |
Carbon\Unit|string $unit, mixed $params
Carbon
Modify to end of current given unit.
Examples:
echo Carbon::parse('2018-07-25 12:45:16.334455')
->startOf(Unit::Month)
->endOf(Unit::Week, Carbon::FRIDAY);
Prototype changed | 3.8.0 | Carbon\Unit|string $unit, mixed $params |
Prototype changed | 3.0.0 | string $unit, mixed $params |
Method added | 2.0.0 | $unit, $params |
DateTimeInterface|string $date
bool
Determines if the instance is equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is not equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is not equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is greater (after) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is greater (after) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is greater (after) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Method added | 1.39.0 | $date |
DateTimeInterface|string $date
bool
Determines if the instance is greater (after) than or equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is greater (after) than or equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is less (before) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is less (before) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is less (before) than another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Method added | 1.39.0 | $date |
DateTimeInterface|string $date
bool
Determines if the instance is less (before) or equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.0.0 | Carbon\Carbon $date |
DateTimeInterface|string $date
bool
Determines if the instance is less (before) or equal to another
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date |
Prototype changed | 1.24.0 | $date |
Prototype changed | 1.23.0 | self $date |
Method added | 1.22.0 | Carbon\Carbon $date |
DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = 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.
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true |
Prototype changed | 1.24.0 | $date1, $date2, $equal = true |
Prototype changed | 1.23.0 | self $dt1, self $dt2, $equal = true |
Method added | 1.3.0 | Carbon\Carbon $dt1, Carbon\Carbon $dt2, $equal = true |
DateTimeInterface|string $date1, DateTimeInterface|string $date2
bool
Determines if the instance is between two others, bounds included.
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date1, DateTimeInterface|string $date2 |
Method added | 2.31.0 | $date1, $date2 |
DateTimeInterface|string $date1, DateTimeInterface|string $date2
bool
Determines if the instance is between two others, bounds excluded.
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date1, DateTimeInterface|string $date2 |
Method added | 2.22.0 | $date1, $date2 |
DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true
bool
Determines if the instance is between two others
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true |
Method added | 1.39.0 | $date1, $date2, $equal = true |
bool
Determines if the instance is a weekday.
Examples:
Carbon::parse('2019-07-14')->isWeekday(); // false
Carbon::parse('2019-07-15')->isWeekday(); // true
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is a weekend day.
Examples:
Carbon::parse('2019-07-14')->isWeekend(); // true
Carbon::parse('2019-07-15')->isWeekend(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is yesterday.
Examples:
Carbon::yesterday()->isYesterday(); // true
Carbon::tomorrow()->isYesterday(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is today.
Examples:
Carbon::today()->isToday(); // true
Carbon::tomorrow()->isToday(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is tomorrow.
Examples:
Carbon::tomorrow()->isTomorrow(); // true
Carbon::yesterday()->isTomorrow(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is in the future, ie. greater (after) than now.
Examples:
Carbon::now()->addHours(5)->isFuture(); // true
Carbon::now()->subHours(5)->isFuture(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is in the past, ie. less (before) than now.
Examples:
Carbon::now()->subHours(5)->isPast(); // true
Carbon::now()->addHours(5)->isPast(); // false
Method added | 1.0.0 | no arguments |
bool
Determines if the instance is a leap year.
Examples:
Carbon::parse('2020-01-01')->isLeapYear(); // true
Carbon::parse('2019-01-01')->isLeapYear(); // false
Method added | 1.0.0 | no arguments |
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.
Examples:
Carbon::create(2015)->isLongYear(); // true
Carbon::create(2016)->isLongYear(); // false
Method added | 1.22.0 | no arguments |
bool
Determines if the instance is a long year (using ISO 8601 year).
Examples:
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
Method added | 2.65.0 | no arguments |
string $format, DateTimeInterface|string $date
bool
Compares the formatted values of the two dates.
Examples:
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
Prototype changed | 3.0.0 | string $format, DateTimeInterface|string $date |
Prototype changed | 1.23.0 | $format, $date = null |
Method added | 1.22.0 | $format, ?Carbon\Carbon $date = null |
string $unit, DateTimeInterface|string $date
bool
Determines if the instance is in the current unit given.
Examples:
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
Prototype changed | 3.0.0 | string $unit, DateTimeInterface|string $date |
Method added | 2.0.0 | $unit, $date = null |
string $unit
bool
Determines if the instance is in the current unit given.
Examples:
Carbon::now()->isCurrentUnit('hour'); // true
Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false
Prototype changed | 3.0.0 | string $unit |
Method added | 2.0.0 | $unit |
DateTimeInterface|string $date, bool $ofSameYear = true
bool
Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date, bool $ofSameYear = true |
Prototype changed | 2.0.0 | $date = null, $ofSameYear = true |
Prototype changed | 1.29.2 | $date = null, $ofSameYear = null |
Method added | 1.26.4 | $date = null, $ofSameYear = false |
DateTimeInterface|string $date, bool $ofSameYear = true
bool
Checks if the passed in date is in the same month as the instance´s month.
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string $date, bool $ofSameYear = true |
Prototype changed | 2.0.0 | $date = null, $ofSameYear = true |
Prototype changed | 1.29.2 | $date = null, $ofSameYear = null |
Prototype changed | 1.23.0 | $date = null, $ofSameYear = false |
Method added | 1.22.0 | ?Carbon\Carbon $date = null, $ofSameYear = false |
$dayOfWeek
bool
Checks if this day is a specific day of the week.
Examples:
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
Method added | 1.24.0 | $dayOfWeek |
DateTimeInterface|string|null $date = null
bool
Check if its the birthday. Compares the date/month values of the two dates.
Examples:
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
Prototype changed | 3.0.0 | DateTimeInterface|string|null $date = null |
Prototype changed | 1.23.0 | $date = null |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null |
Method added | 1.14.0 | Carbon\Carbon $date |
bool
Check if today is the last day of the Month
Examples:
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
Method added | 1.24.0 | no arguments |
Carbon\Unit $unit, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, mixed $params
bool
Check if the instance is start of a given unit (tolerating a given interval).
Examples:
// 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
Method added | 3.8.0 | Carbon\Unit $unit, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, mixed $params |
Carbon\Unit $unit, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, mixed $params
bool
Check if the instance is end of a given unit (tolerating a given interval).
Examples:
// 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
Method added | 3.8.0 | Carbon\Unit $unit, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, mixed $params |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of millisecond (first microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of millisecond (last microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of second (first microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of second (last microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of minute (first microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of minute (last microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of hour (first microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of hour (last microsecond by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|bool $checkMicroseconds = false, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Check if the instance is start of day / midnight.
Examples:
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
Prototype changed | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|bool $checkMicroseconds = false, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Prototype changed | 3.0.0 | bool $checkMicroseconds = false |
Method added | 1.28.0 | $checkMicroseconds = false |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|bool $checkMicroseconds = false, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Check if the instance is end of day.
Examples:
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
Prototype changed | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|bool $checkMicroseconds = false, Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Prototype changed | 3.0.0 | bool $checkMicroseconds = false |
Method added | 1.28.0 | $checkMicroseconds = false |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, Carbon\WeekDay|int|null $weekStartsAt = null
bool
Determines if the instance is start of week (first day by default but interval can be customized).
Examples:
Carbon::parse('2024-08-31')->startOfWeek()->isStartOfWeek(); // true
Carbon::parse('2024-08-31')->isStartOfWeek(); // false
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, Carbon\WeekDay|int|null $weekStartsAt = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, Carbon\WeekDay|int|null $weekEndsAt = null
bool
Determines if the instance is end of week (last day by default but interval can be customized).
Examples:
Carbon::parse('2024-08-31')->endOfWeek()->isEndOfWeek(); // true
Carbon::parse('2024-08-31')->isEndOfWeek(); // false
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null, Carbon\WeekDay|int|null $weekEndsAt = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of month (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of month (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of quarter (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of quarter (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of year (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of year (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of decade (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of decade (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of century (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of century (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is start of millennium (first day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null
bool
Determines if the instance is end of millennium (last day by default but interval can be customized).
Method added | 3.8.0 | Carbon\Unit|DateInterval|Closure|Carbon\CarbonConverterInterface|string|null $interval = null |
bool
Check if the instance is start of day / midnight.
Examples:
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
Method added | 1.28.0 | no arguments |
bool
Check if the instance is midday.
Examples:
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
Method added | 1.28.0 | no arguments |
string $date, string $format
bool
Checks if the (date)time string is in a given format.
Examples:
Carbon::hasFormat('11:12:45', 'h:i:s'); // true
Carbon::hasFormat('13:12:45', 'h:i:s'); // false
Prototype changed | 3.0.0 | string $date, string $format |
Method added | 1.24.0 | $date, $format |
?string $date, string $format
bool
Checks if the (date)time string is in a given format.
Examples:
Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true
Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false
Prototype changed | 3.0.0 | ?string $date, string $format |
Prototype changed | 2.41.2 | $date, $format |
Method added | 2.41.0 | string $date, string $format |
?string $date, string $format
bool
Checks if the (date)time string is in a given format and valid to create a new instance.
Examples:
Carbon::canBeCreatedFromFormat('11:12:45', 'h:i:s'); // true
Carbon::canBeCreatedFromFormat('13:12:45', 'h:i:s'); // false
Prototype changed | 3.0.0 | ?string $date, string $format |
Method added | 2.39.1 | $date, $format |
Carbon\WeekDay|Carbon\Month|string $tester
bool
Returns true if the current date matches the given string.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true
\Carbon\Doc\Generate\var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false
Prototype changed | 3.6.0 | Carbon\WeekDay|Carbon\Month|string $tester |
Method added | 2.20.0 | string $tester |
bool
Returns true if the date was created using CarbonImmutable::startOfTime()
Method added | 2.48.0 | no arguments |
bool
Returns true if the date was created using CarbonImmutable::endOfTime()
Method added | 2.48.0 | no arguments |
string $format
string
See php.net/manual/en/datetime.format.php
Prototype changed | 3.0.0 | string $format |
Method added | 2.16.0 | $format |
string
Format the instance as a string using the set format
Examples:
echo Carbon::now(); // Carbon instances can be cast to string
Method added | 1.0.0 | no arguments |
string
Format the instance as date
Examples:
echo Carbon::now()->toDateString();
Method added | 1.0.0 | no arguments |
string
Format the instance as a readable date
Examples:
echo Carbon::now()->toFormattedDateString();
Method added | 1.0.0 | no arguments |
string
Format the instance with the day, and a readable date
Examples:
echo Carbon::now()->toFormattedDayDateString();
Method added | 2.62.0 | no arguments |
string $unitPrecision = 'second'
string
Format the instance as time
Examples:
echo Carbon::now()->toTimeString();
Prototype changed | 3.0.0 | string $unitPrecision = 'second' |
Prototype changed | 2.26.0 | $unitPrecision = 'second' |
Method added | 1.0.0 | no arguments |
string $unitPrecision = 'second'
string
Format the instance as date and time
Examples:
echo Carbon::now()->toDateTimeString();
Prototype changed | 3.0.0 | string $unitPrecision = 'second' |
Prototype changed | 2.26.0 | $unitPrecision = 'second' |
Method added | 1.0.0 | no arguments |
string $unitPrecision
string
Return a format from H:i to H:i:s.u according to given unit precision.
Prototype changed | 3.0.0 | string $unitPrecision |
Method added | 2.26.0 | $unitPrecision |
string $unitPrecision = 'second'
string
Format the instance as date and time T-separated with no timezone
Examples:
echo Carbon::now()->toDateTimeLocalString();
echo "\n";
echo Carbon::now()->toDateTimeLocalString('minute'); // You can specify precision among: minute, second, millisecond and microsecond
Prototype changed | 3.0.0 | string $unitPrecision = 'second' |
Prototype changed | 2.26.0 | $unitPrecision = 'second' |
Method added | 1.39.0 | no arguments |
string
Format the instance with day, date and time
Examples:
echo Carbon::now()->toDayDateTimeString();
Method added | 1.0.0 | no arguments |
string
Format the instance as ATOM
Examples:
echo Carbon::now()->toAtomString();
Method added | 1.13.0 | no arguments |
string
Format the instance as COOKIE
Examples:
echo Carbon::now()->toCookieString();
Method added | 1.13.0 | no arguments |
string
Format the instance as ISO8601
Examples:
echo Carbon::now()->toIso8601String();
Method added | 1.13.0 | no arguments |
string
Format the instance as RFC822
Examples:
echo Carbon::now()->toRfc822String();
Method added | 1.13.0 | no arguments |
string $unitPrecision = 'second'
string
Convert the instance to UTC and return as Zulu ISO8601
Examples:
echo Carbon::now()->toIso8601ZuluString();
Prototype changed | 3.0.0 | string $unitPrecision = 'second' |
Prototype changed | 2.26.0 | $unitPrecision = 'second' |
Method added | 1.24.0 | no arguments |
string
Format the instance as RFC850
Examples:
echo Carbon::now()->toRfc850String();
Method added | 1.13.0 | no arguments |
string
Format the instance as RFC1036
Examples:
echo Carbon::now()->toRfc1036String();
Method added | 1.13.0 | no arguments |
string
Format the instance as RFC1123
Examples:
echo Carbon::now()->toRfc1123String();
Method added | 1.13.0 | no arguments |
string
Format the instance as RFC2822
Examples:
echo Carbon::now()->toRfc2822String();
Method added | 1.13.0 | no arguments |
bool $extended = false
string
Format the instance as RFC3339.
Examples:
echo Carbon::now()->toRfc3339String() . "\n";
echo Carbon::now()->toRfc3339String(true) . "\n";
Prototype changed | 3.0.0 | bool $extended = false |
Prototype changed | 2.39.0 | $extended = false |
Method added | 1.13.0 | no arguments |
string
Format the instance as RSS
Examples:
echo Carbon::now()->toRssString();
Method added | 1.13.0 | no arguments |
string
Format the instance as W3C
Examples:
echo Carbon::now()->toW3cString();
Method added | 1.13.0 | no arguments |
string
Format the instance as RFC7231
Examples:
echo Carbon::now()->toRfc7231String();
Method added | 1.24.0 | no arguments |
array
Get default array representation.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::now()->toArray());
Method added | 1.24.0 | no arguments |
object
Get default object representation.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::now()->toObject());
Method added | 1.39.0 | no arguments |
string
Returns english human-readable complete date string.
Examples:
echo Carbon::now()->toString();
Method added | 1.39.0 | no arguments |
bool $keepOffset = 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).
Examples:
echo Carbon::now('America/Toronto')->toISOString() . "\n";
echo Carbon::now('America/Toronto')->toISOString(true) . "\n";
Prototype changed | 3.0.0 | bool $keepOffset = false |
Method added | 1.39.0 | $keepOffset = false |
string
Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.
Examples:
echo Carbon::now('America/Toronto')->toJSON();
Method added | 1.39.0 | no arguments |
DateTime
Return native DateTime PHP object matching the current instance.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::now()->toDateTime());
Method added | 1.39.0 | no arguments |
DateTimeImmutable
Return native toDateTimeImmutable PHP object matching the current instance.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::now()->toDateTimeImmutable());
Method added | 2.23.0 | no arguments |
DateTime
@alias toDateTime
Return native DateTime PHP object matching the current instance.
Examples:
\Carbon\Doc\Generate\var_dump(Carbon::now()->toDate());
Method added | 1.39.0 | no arguments |
$end = null, $interval = null, $unit = null
CarbonPeriod
Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
Method added | 2.20.0 | $end = null, $interval = null, $unit = null |
$end = null, $interval = null, $unit = null
CarbonPeriod
Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
Method added | 2.20.0 | $end = null, $interval = null, $unit = null |
Reset the format used to the default when type juggling a Carbon instance to a string
Method added | 1.5.0 | no arguments |
Closure|string|null $format
Prototype changed | 3.0.0 | Closure|string|null $format |
Method added | 1.5.0 | $format |
Update constructedObjectId on cloned.
Method added | 2.29.0 | no arguments |
DateTimeInterface $date
Carbon
Create a Carbon instance from a DateTime one.
Prototype changed | 3.0.0 | DateTimeInterface $date |
Prototype changed | 1.26.0 | $date |
Method added | 1.0.0 | DateTime $date |
DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null
Carbon
Create a carbon instance from a string.
This is an alias for the constructor that allows better fluent syntax
as it allows you to do Carbon::parse('Monday next week')->fn() rather
than (new Carbon('Monday next week'))->fn().
Prototype changed | 3.0.0 | DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null |
Method added | 2.16.0 | $time = null, $tz = null |
DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null
Carbon
Create a carbon instance from a string.
This is an alias for the constructor that allows better fluent syntax
as it allows you to do Carbon::parse('Monday next week')->fn() rather
than (new Carbon('Monday next week'))->fn().
Prototype changed | 3.0.0 | DateTimeInterface|Carbon\WeekDay|Carbon\Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null |
Method added | 1.3.0 | $time = null, $tz = null |
string $time, ?string $locale = null, DateTimeZone|string|int|null $timezone = null
Carbon
Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).
Prototype changed | 3.0.0 | string $time, ?string $locale = null, DateTimeZone|string|int|null $timezone = null |
Prototype changed | 2.35.0 | $time, $locale = null, $tz = null |
Method added | 2.16.0 | $time, $locale, $tz = null |
DateTimeZone|string|int|null $timezone = null
Carbon
Get a Carbon instance for the current date and time.
Prototype changed | 3.0.0 | DateTimeZone|string|int|null $timezone = null |
Method added | 1.0.0 | $tz = null |
DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance for today.
Prototype changed | 3.0.0 | DateTimeZone|string|int|null $timezone = null |
Method added | 1.1.0 | $tz = null |
DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance for tomorrow.
Prototype changed | 3.0.0 | DateTimeZone|string|int|null $timezone = null |
Method added | 1.1.0 | $tz = null |
DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance for yesterday.
Prototype changed | 3.0.0 | DateTimeZone|string|int|null $timezone = null |
Method added | 1.1.0 | $tz = null |
$year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null
Carbon
Create a new Carbon instance from a specific date and time.
If any of $year, $month or $day are set to null their now() values will
be used.
If $hour is null it will be set to its now() value and the default
values for $minute and $second will be their now() values.
If $hour is not null then the default values for $minute and $second
will be 0.
Prototype changed | 3.0.0 | $year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null |
Prototype changed | 2.0.0 | $year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null |
Method added | 1.0.0 | $year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null |
$year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null
Carbon
Create a new safe Carbon instance from a specific date and time.
If any of $year, $month or $day are set to null their now() values will
be used.
If $hour is null it will be set to its now() value and the default
values for $minute and $second will be their now() values.
If $hour is not null then the default values for $minute and $second
will be 0.
If one of the set values is not valid, an InvalidDateException
will be thrown.
Prototype changed | 3.0.0 | $year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null |
Method added | 1.22.0 | $year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null |
?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null
Carbon
Create a new Carbon instance from a specific date and time using strict validation.
Prototype changed | 3.0.0 | ?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null |
Method added | 2.49.0 | ?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null |
$year = null, $month = null, $day = null, $timezone = null
Carbon
Create a Carbon instance from just a date. The time portion is set to now.
Prototype changed | 3.0.0 | $year = null, $month = null, $day = null, $timezone = null |
Method added | 1.0.0 | $year = null, $month = null, $day = null, $tz = null |
$year = null, $month = null, $day = null, $timezone = null
Carbon
Create a Carbon instance from just a date. The time portion is set to midnight.
Prototype changed | 3.0.0 | $year = null, $month = null, $day = null, $timezone = null |
Method added | 1.24.0 | $year = null, $month = null, $day = null, $tz = null |
$hour = 0, $minute = 0, $second = 0, $timezone = null
Carbon
Create a Carbon instance from just a time. The date portion is set to today.
Prototype changed | 3.0.0 | $hour = 0, $minute = 0, $second = 0, $timezone = null |
Prototype changed | 2.0.0 | $hour = 0, $minute = 0, $second = 0, $tz = null |
Method added | 1.0.0 | $hour = null, $minute = null, $second = null, $tz = null |
string $time, DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance from a time string. The date portion is set to today.
Prototype changed | 3.0.0 | string $time, DateTimeZone|string|int|null $timezone = null |
Method added | 1.25.0 | $time, $tz = null |
string $format, string $time, $timezone = null
Carbon
Create a Carbon instance from a specific format.
Prototype changed | 3.0.0 | string $format, string $time, $timezone = null |
Method added | 2.16.0 | $format, $time, $tz = null |
string $format, string $time, $timezone = null, ?string $locale = 'en', ?Symfony\Contracts\Translation\TranslatorInterface $translator = null
Carbon
Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).
Prototype changed | 3.0.0 | string $format, string $time, $timezone = null, ?string $locale = 'en', ?Symfony\Contracts\Translation\TranslatorInterface $translator = null |
Method added | 2.16.0 | $format, $time, $tz = null, $locale = 'en', $translator = null |
string $format, string $locale, string $time, $timezone = null
Carbon
Create a Carbon instance from a specific format and a string in a given language.
Prototype changed | 3.0.0 | string $format, string $locale, string $time, $timezone = null |
Method added | 2.16.0 | $format, $locale, $time, $tz = null |
string $format, string $locale, string $time, $timezone = null
Carbon
Create a Carbon instance from a specific ISO format and a string in a given language.
Prototype changed | 3.0.0 | string $format, string $locale, string $time, $timezone = null |
Method added | 2.16.0 | $format, $locale, $time, $tz = null |
$var, DateTimeZone|string|null $timezone = null
Carbon
Make a Carbon instance from given variable if possible.
Always return a new instance. Parse only strings and only these likely to be dates (skip intervals
and recurrences). Throw an exception for invalid format, but otherwise return null.
Prototype changed | 3.6.0 | $var, DateTimeZone|string|null $timezone = null |
Method added | 1.28.0 | $var |
WrapperClock
Method added | 3.0.0 | no arguments |
$date = null, bool $absolute = 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).
Method added | 3.0.0 | $date = null, bool $absolute = false |
$date = null, bool $absolute = false, array $skip = []
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).
Prototype changed | 3.0.0 | $date = null, bool $absolute = false, array $skip = [] |
Prototype changed | 2.64.0 | $date = null, $absolute = true, array $skip = [] |
Prototype changed | 2.0.0 | $date = null, $absolute = true |
Prototype changed | 1.35.0 | $date = null, $absolute = true, $trimMicroseconds = true |
Method added | 1.26.0 | $date = null, $absolute = true |
Carbon\Unit|string $unit, $date = null, bool $absolute = false, bool $utc = false
float
@param Unit|string $unit microsecond, millisecond, second, minute, hour, day, week, month, quarter, year, century, millennium
Prototype changed | 3.2.0 | Carbon\Unit|string $unit, $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.1.0 | Carbon\Unit|string $unit, $date = null, bool $absolute = false |
Method added | 3.0.0 | string $unit, $date = null, bool $absolute = false |
$date = null, bool $absolute = false, bool $utc = false
float
Get the difference in years
Prototype changed | 3.2.0 | $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false, bool $utc = false
float
Get the difference in quarters.
Prototype changed | 3.2.0 | $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Method added | 2.31.0 | $date = null, $absolute = true |
$date = null, bool $absolute = false, bool $utc = false
float
Get the difference in months.
Prototype changed | 3.2.0 | $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false, bool $utc = false
float
Get the difference in weeks.
Prototype changed | 3.2.0 | $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.11.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false, bool $utc = false
float
Get the difference in days.
Prototype changed | 3.2.0 | $date = null, bool $absolute = false, bool $utc = false |
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
Closure $callback, $date = null, bool $absolute = false
int
Get the difference in days using a filter closure.
Prototype changed | 3.0.0 | Closure $callback, $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | Closure $callback, $date = null, $absolute = true |
Prototype changed | 1.23.0 | Closure $callback, ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | Closure $callback, ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.12.0 | Closure $callback, Carbon\Carbon $date = null, $absolute = true |
Closure $callback, $date = null, bool $absolute = false
int
Get the difference in hours using a filter closure.
Prototype changed | 3.0.0 | Closure $callback, $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | Closure $callback, $date = null, $absolute = true |
Prototype changed | 1.23.0 | Closure $callback, ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | Closure $callback, ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.18.0 | Closure $callback, Carbon\Carbon $date = null, $absolute = true |
Carbon\CarbonInterval $ci, Closure $callback, $date = null, bool $absolute = false
int
Get the difference by the given interval using a filter closure.
Prototype changed | 3.0.0 | Carbon\CarbonInterval $ci, Closure $callback, $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | Carbon\CarbonInterval $ci, Closure $callback, $date = null, $absolute = true |
Prototype changed | 1.23.0 | Carbon\CarbonInterval $ci, Closure $callback, ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | Carbon\CarbonInterval $ci, Closure $callback, ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.18.0 | Carbon\CarbonInterval $ci, Closure $callback, Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
int
Get the difference in weekdays.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.12.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
int
Get the difference in weekend days using a filter.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.12.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
float
Get the difference in hours.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
float
Get the difference in minutes.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
float
Get the difference in seconds.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Prototype changed | 1.24.0 | $date = null, $absolute = true |
Prototype changed | 1.23.0 | ?self $date = null, $absolute = true |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null, $absolute = true |
Method added | 1.0.0 | Carbon\Carbon $date = null, $absolute = true |
$date = null, bool $absolute = false
float
Get the difference in microseconds.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Method added | 1.39.0 | $date = null, $absolute = true |
$date = null, bool $absolute = false
float
Get the difference in milliseconds.
Prototype changed | 3.0.0 | $date = null, bool $absolute = false |
Method added | 1.39.0 | $date = null, $absolute = true |
float
The number of seconds since midnight.
Method added | 1.14.0 | no arguments |
float
The number of seconds until 23:59:59.
Method added | 1.14.0 | no arguments |
$other = null, $syntax = null, $short = false, $parts = 1, $options = null
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).
Examples:
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";
Prototype changed | 2.0.0 | $other = null, $syntax = null, $short = false, $parts = 1, $options = null |
Prototype changed | 1.25.0 | $other = null, $absolute = false, $short = false, $parts = 1 |
Prototype changed | 1.23.0 | ?self $other = null, $absolute = false, $short = false, $parts = 1 |
Prototype changed | 1.22.0 | ?Carbon\Carbon $other = null, $absolute = false, $short = false |
Prototype changed | 1.21.0 | ?Carbon\Carbon $other = null, $absolute = false |
Prototype changed | 1.14.0 | Carbon\Carbon $other = null, $absolute = false |
Method added | 1.0.0 | Carbon\Carbon $other = null |
$other = null, $syntax = null, $short = false, $parts = 1, $options = null
string
@alias diffForHumans
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).
Prototype changed | 2.0.0 | $other = null, $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $other = null, $absolute = false, $short = false, $parts = 1 |
$other = null, $syntax = null, $short = false, $parts = 1, $options = null
@alias diffForHumans
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).
Prototype changed | 2.0.0 | $other = null, $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $other = null, $absolute = false, $short = false, $parts = 1 |
$other = null, $syntax = null, $short = false, $parts = 1, $options = null
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
Prototype changed | 2.0.0 | $other = null, $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $other = null, $absolute = false, $short = false, $parts = 1 |
$other = null, $syntax = null, $short = false, $parts = 1, $options = null
string
@alias to
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.
Prototype changed | 2.0.0 | $other = null, $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $other = null, $absolute = false, $short = false, $parts = 1 |
$syntax = null, $short = false, $parts = 1, $options = null
string
Get the difference in a human readable format in the current locale from current instance to now.
Prototype changed | 2.0.0 | $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $absolute = null, $short = false, $parts = 1 |
$syntax = null, $short = false, $parts = 1, $options = null
string
Get the difference in a human readable format in the current locale from an other instance given to now
Prototype changed | 2.0.0 | $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $absolute = null, $short = false, $parts = 1 |
$syntax = null, $short = false, $parts = 1, $options = null
string
Get the difference in a human readable format in the current locale from an other instance given to now
Prototype changed | 2.16.0 | $syntax = null, $short = false, $parts = 1, $options = null |
Method added | 1.39.0 | $absolute = null, $short = false, $parts = 1 |
$other = null, $timezone = null
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).
Method added | 2.16.0 | $other = null, $timezone = null |
$referenceTime = null, array $formats = []
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.
Method added | 2.0.0 | $referenceTime = null, array $formats = [] |
string $name, ?callable $macro
Register a custom macro.
Pass null macro to remove it.
Examples:
$userSettings = [
'locale' => 'pt',
'timezone' => 'America/Sao_Paulo',
];
Carbon::macro('userFormat', function () use ($userSettings) {
return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar();
});
echo Carbon::yesterday()->hours(11)->userFormat();
Prototype changed | 3.0.1 | string $name, ?callable $macro |
Prototype changed | 3.0.0 | string $name, callable|object $macro |
Method added | 1.26.0 | $name, $macro |
Remove all macros and generic macros.
Method added | 1.39.0 | no arguments |
callable $macro, int $priority = 0
Register a custom macro.
Prototype changed | 3.0.1 | callable $macro, int $priority = 0 |
Prototype changed | 3.0.0 | callable|object $macro, int $priority = 0 |
Method added | 2.1.0 | $macro, $priority = 0 |
string $name
bool
Checks if macro is registered globally.
Prototype changed | 3.0.0 | string $name |
Method added | 1.26.0 | $name |
string $name
callable
Get the raw callable macro registered globally for a given name.
Prototype changed | 3.0.0 | string $name |
Method added | 2.29.0 | $name |
string $name
bool
Checks if macro is registered globally or locally.
Prototype changed | 3.0.0 | string $name |
Method added | 2.29.0 | $name |
string $name
callable
Get the raw callable macro registered globally or locally for a given name.
Prototype changed | 3.0.0 | string $name |
Method added | 2.29.0 | $name |
object|string $mixin
Mix another object into the class.
Examples:
Carbon::mixin(new class {
public function addMoon() {
return function () {
return $this->addDays(30);
};
}
public function subMoon() {
return function () {
return $this->subDays(30);
};
}
});
$fullMoon = Carbon::create('2018-12-22');
$nextFullMoon = $fullMoon->addMoon();
$blackMoon = Carbon::create('2019-01-06');
$previousBlackMoon = $blackMoon->subMoon();
echo "$nextFullMoon\n";
echo "$previousBlackMoon\n";
Prototype changed | 3.0.0 | object|string $mixin |
Method added | 1.26.0 | $mixin |
int
get midday/noon hour
Method added | 1.24.0 | no arguments |
$hour
Method added | 1.24.0 | $hour |
Carbon
Modify to midday, default to self::$midDayAt
Method added | 1.24.0 | no arguments |
$modifier = null
Carbon
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.
Prototype changed | 2.20.0 | $modifier = null |
Method added | 1.3.0 | $dayOfWeek = null |
Carbon
Go forward to the next weekday.
Method added | 1.22.0 | no arguments |
Carbon
Go backward to the previous weekday.
Method added | 1.22.0 | no arguments |
Carbon
Go forward to the next weekend day.
Method added | 1.22.0 | no arguments |
Carbon
Go backward to the previous weekend day.
Method added | 1.22.0 | no arguments |
$modifier = null
Carbon
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.
Prototype changed | 2.20.0 | $modifier = null |
Method added | 1.3.0 | $dayOfWeek = null |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$nth, $dayOfWeek
mixed
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.
Method added | 1.3.0 | $nth, $dayOfWeek |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$nth, $dayOfWeek
mixed
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.
Method added | 1.3.0 | $nth, $dayOfWeek |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$dayOfWeek = null
Carbon
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.
Method added | 1.3.0 | $dayOfWeek = null |
$nth, $dayOfWeek
mixed
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.
Method added | 1.3.0 | $nth, $dayOfWeek |
$date = null
Carbon
Modify the current instance to the average of a given instance (default now) and the current instance (second-precision).
Prototype changed | 1.24.0 | $date = null |
Prototype changed | 1.23.0 | ?self $date = null |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null |
Method added | 1.7.0 | Carbon\Carbon $date = null |
$date1, $date2
Carbon
Get the closest date from the instance (second-precision).
Prototype changed | 1.24.0 | $date1, $date2 |
Prototype changed | 1.23.0 | self $dt1, self $dt2 |
Method added | 1.21.0 | Carbon\Carbon $dt1, Carbon\Carbon $dt2 |
$date1, $date2
Carbon
Get the farthest date from the instance (second-precision).
Prototype changed | 1.24.0 | $date1, $date2 |
Prototype changed | 1.23.0 | self $dt1, self $dt2 |
Method added | 1.21.0 | Carbon\Carbon $dt1, Carbon\Carbon $dt2 |
$date = null
Carbon
Get the minimum instance between a given instance (default now) and the current instance.
Prototype changed | 1.24.0 | $date = null |
Prototype changed | 1.23.0 | ?self $date = null |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null |
Method added | 1.8.0 | Carbon\Carbon $date = null |
$date = null
Carbon
Get the minimum instance between a given instance (default now) and the current instance.
Prototype changed | 1.24.0 | $date = null |
Prototype changed | 1.23.0 | ?self $date = null |
Method added | 1.22.0 | ?Carbon\Carbon $date = null |
$date = null
Carbon
Get the maximum instance between a given instance (default now) and the current instance.
Prototype changed | 1.24.0 | $date = null |
Prototype changed | 1.23.0 | ?self $date = null |
Prototype changed | 1.21.0 | ?Carbon\Carbon $date = null |
Method added | 1.8.0 | Carbon\Carbon $date = null |
$date = null
Carbon
Get the maximum instance between a given instance (default now) and the current instance.
Prototype changed | 1.24.0 | $date = null |
Prototype changed | 1.23.0 | ?self $date = null |
Method added | 1.22.0 | ?Carbon\Carbon $date = null |
$modifier
Carbon
Similar to native modify() method of DateTime but can handle more grammars.
Examples:
echo Carbon::now()->change('next 2pm');
Method added | 2.20.0 | $modifier |
bool
Returns true if the current class/instance is immutable.
Method added | 2.0.0 | no arguments |
Carbon
Return a mutable copy of the instance.
Method added | 2.0.0 | no arguments |
CarbonImmutable
Return a immutable copy of the instance.
Method added | 2.0.0 | no arguments |
string $className
mixed
Cast the current instance into the given class.
Prototype changed | 2.8.0 | string $className |
Method added | 1.39.0 | $className |
array $settings
Carbon
Set specific options. - strictMode: true|false|null - monthOverflow: true|false|null - yearOverflow: true|false|null - humanDiffOptions: int|null - toStringFormat: string|Closure|null - toJsonFormat: string|Closure|null - locale: string|null - timezone: \DateTimeZone|string|int|null - macros: array|null - genericMacros: array|null
Method added | 2.0.0 | array $settings |
array
Returns current local settings.
Method added | 2.3.0 | no arguments |
array
Show truthy properties on \Carbon\Doc\Generate\var_dump().
Method added | 1.39.0 | no arguments |
bool $strictModeEnabled = true
Prototype changed | 3.0.0 | bool $strictModeEnabled = true |
Method added | 2.0.0 | $strictModeEnabled = true |
bool
Returns true if the strict mode is globally in use, false else. (It can be overridden in specific instances.)
Method added | 2.0.0 | no arguments |
bool $monthsOverflow = true
Prototype changed | 3.0.0 | bool $monthsOverflow = true |
Method added | 1.22.0 | $monthsOverflow = true |
Method added | 1.22.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 1.22.0 | no arguments |
bool $yearsOverflow = true
Prototype changed | 3.0.0 | bool $yearsOverflow = true |
Method added | 1.24.0 | $yearsOverflow = true |
Method added | 1.24.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 1.24.0 | no arguments |
bool
Return true if the current instance has its own translator.
Method added | 2.29.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface
Get the translator of the current instance or the default if none set.
Method added | 2.0.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
Carbon
Set the translator for the current instance.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 2.0.0 | Symfony\Component\Translation\TranslatorInterface $translator |
$translator, string $key, ?string $locale = null, ?string $default = null
string|Closure|null
Returns raw translation message for a given key.
Method added | 2.8.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
string $key, ?string $locale = null, ?string $default = null, $translator = null
string
Returns raw translation message for a given key.
Prototype changed | 2.8.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Method added | 2.0.0 | string $key, ?string $locale = null, ?string $default = null |
Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
Method added | 2.8.0 | Symfony\Component\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.8.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null |
Method added | 2.0.0 | string $key, array $parameters = [], $number = null |
int $number
string
Returns the alternative number for a given integer if available in the current locale.
Method added | 2.23.0 | int $number |
string $timeString, ?string $from = null, ?string $to = null, int $mode = 31
string
Translate a time string from a locale to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $from = null, ?string $to = null, int $mode = 31 |
Prototype changed | 2.35.0 | $timeString, $from = null, $to = null, $mode = 31 |
Method added | 2.16.0 | $timeString, $from = null, $to = null, $mode = 15 |
string $timeString, ?string $to = null
string
Translate a time string from the current locale (`$date->locale()`) to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $to = null |
Method added | 2.16.0 | $timeString, $to = null |
?string $locale = null, string $fallbackLocales
Carbon|string
Get/set the locale for the current instance.
Prototype changed | 3.0.0 | ?string $locale = null, string $fallbackLocales |
Prototype changed | 2.16.0 | ?string $locale = null, $fallbackLocales |
Method added | 2.0.0 | ?string $locale = null |
string
Get the current translator locale.
Method added | 1.18.0 | no arguments |
string $locale
Set the current translator locale and indicate if the source locale file exists. Pass 'auto' as locale to use the closest language to the current LC_TIME locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.18.0 | $locale |
string $locale
Set the fallback locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.16.0 | $locale |
string
Get the fallback locale.
Method added | 2.16.0 | no arguments |
string $locale, callable $func
mixed
Set the current locale to the given, execute the passed function, reset the locale to previous one, then return the result of the closure (or null if the closure was void).
Prototype changed | 3.0.0 | string $locale, callable $func |
Method added | 1.31.0 | $locale, $func |
string $locale
bool
Returns true if the given locale is internally supported and has short-units support. Support is considered enabled if either year, day or hour has a short variant translated.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.31.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). Support is considered enabled if the 4 sentences are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.31.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). Support is considered enabled if the 3 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.31.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). Support is considered enabled if the 2 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.31.0 | $locale |
$locale
bool
Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). Support is considered enabled if the 4 sentences are translated in the given locale.
Method added | 1.31.0 | $locale |
array
Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)
Method added | 1.31.0 | no arguments |
Language[]
Returns list of Language object for each available locale. This object allow you to get the ISO name, native name, region and variant of the locale.
Method added | 2.10.1 | no arguments |
int $humanDiffOptions
Prototype changed | 3.0.0 | int $humanDiffOptions |
Method added | 1.26.0 | $humanDiffOptions |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 1.26.0 | $humanDiffOption |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 1.26.0 | $humanDiffOption |
int
Return default humanDiff() options (merged flags as integer).
Method added | 1.26.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
Set the default translator instance to use.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 1.18.0 | Symfony\Component\Translation\TranslatorInterface $translator |
Symfony\Contracts\Translation\TranslatorInterface
Initialize the default translator instance if necessary.
Method added | 1.18.0 | no arguments |
string $unit, DateInterval|string|int|float $precision = 1, callable|string $function = 'round'
Carbon
Round the current instance at the given unit with given precision if specified and the given function.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float $precision = 1, callable|string $function = 'round' |
Method added | 2.0.0 | $unit, $precision = 1, $function = 'round' |
string $unit, DateInterval|string|int|float $precision = 1
Carbon
Truncate the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float $precision = 1 |
Method added | 2.0.0 | $unit, $precision = 1 |
string $unit, DateInterval|string|int|float $precision = 1
Carbon
Ceil the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float $precision = 1 |
Method added | 2.0.0 | $unit, $precision = 1 |
DateInterval|string|int|float $precision = 1, callable|string $function = 'round'
Carbon
Round the current instance second with given precision if specified.
Prototype changed | 3.0.0 | DateInterval|string|int|float $precision = 1, callable|string $function = 'round' |
Method added | 2.0.0 | $precision = 1, $function = 'round' |
DateInterval|string|int|float $precision = 1
Carbon
Round the current instance second with given precision if specified.
Prototype changed | 3.0.0 | DateInterval|string|int|float $precision = 1 |
Method added | 2.0.0 | $precision = 1 |
DateInterval|string|int|float $precision = 1
Carbon
Ceil the current instance second with given precision if specified.
Prototype changed | 3.0.0 | DateInterval|string|int|float $precision = 1 |
Method added | 2.0.0 | $precision = 1 |
Carbon\WeekDay|int|null $weekStartsAt = null
Carbon
Round the current instance week.
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekStartsAt = null |
Method added | 2.0.0 | $weekStartsAt = null |
Carbon\WeekDay|int|null $weekStartsAt = null
Carbon
Truncate the current instance week.
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekStartsAt = null |
Method added | 2.0.0 | $weekStartsAt = null |
Carbon\WeekDay|int|null $weekStartsAt = null
Carbon
Ceil the current instance week.
Prototype changed | 3.0.0 | Carbon\WeekDay|int|null $weekStartsAt = null |
Method added | 2.0.0 | $weekStartsAt = null |
string
Return a serialized string of the instance.
Method added | 1.22.0 | no arguments |
$value
Carbon
Create an instance from a serialized string.
Method added | 1.22.0 | $value |
array
Returns the list of properties to dump on serialize() called on.
Only used by PHP < 7.4.
Method added | 2.0.0 | no arguments |
mixed
Prepare the object for JSON serialization.
Method added | 1.26.0 | no arguments |
callable|string|null $format
Prototype changed | 3.0.0 | callable|string|null $format |
Method added | 1.26.0 | $callback |
Carbon
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)
Method added | 2.29.0 | no arguments |
mixed $testNow = null
Set a Carbon instance (real or mock) to be returned when a "now"
instance is created. The provided instance will be returned
specifically under the following conditions:
- A call to the static now() method, ex. Carbon::now()
- When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
- When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
- When a string containing the desired time is passed to Carbon::parse().
Note the timezone parameter was left out of the examples above and
has no affect as the mock value will be returned regardless of its value.
Only the moment is mocked with setTestNow(), the timezone will still be the one passed
as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()).
To clear the test instance call this method using the default
parameter of null.
/!\ Use this method for unit tests only.
Prototype changed | 3.0.0 | mixed $testNow = null |
Prototype changed | 1.22.0 | $testNow = null |
Prototype changed | 1.21.0 | ?Carbon\Carbon $testNow = null |
Method added | 1.3.0 | Carbon\Carbon $testNow = null |
$testNow = null, $timezone = null
Set a Carbon instance (real or mock) to be returned when a "now"
instance is created. The provided instance will be returned
specifically under the following conditions:
- A call to the static now() method, ex. Carbon::now()
- When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
- When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
- When a string containing the desired time is passed to Carbon::parse().
It will also align default timezone (e.g. call date_default_timezone_set()) with
the second argument or if null, with the timezone of the given date object.
To clear the test instance call this method using the default
parameter of null.
/!\ Use this method for unit tests only.
Prototype changed | 3.0.0 | $testNow = null, $timezone = null |
Method added | 2.54.0 | $testNow = null, $tz = null |
mixed $testNow, callable $callback
mixed
Temporarily sets a static date to be used within the callback.
Using setTestNow to set the date, executing the callback, then
clearing the test instance.
/!\ Use this method for unit tests only.
Prototype changed | 3.0.0 | mixed $testNow, callable $callback |
Prototype changed | 2.67.0 | $testNow, $callback |
Method added | 2.41.0 | $testNow = null, $callback = null |
Closure|CarbonInterface|null
Get the Carbon instance (real or mock) to be returned when a "now" instance is created.
Method added | 1.3.0 | no arguments |
bool
Determine if there is a valid test instance set. A valid test instance is anything that is not null.
Method added | 1.3.0 | no arguments |
string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance from a timestamp and set the timezone (UTC by default).
Timestamp input can be given as int, float or a string containing one or more numbers.
Prototype changed | 3.0.0 | string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null |
Method added | 1.0.0 | $timestamp, $tz = null |
string|int|float $timestamp
Carbon
Create a Carbon instance from a timestamp keeping the timezone to UTC.
Timestamp input can be given as int, float or a string containing one or more numbers.
Prototype changed | 3.0.0 | string|int|float $timestamp |
Method added | 1.0.0 | $timestamp |
$timestamp
Carbon
Create a Carbon instance from a timestamp in milliseconds.
Timestamp input can be given as int, float or a string containing one or more numbers.
Method added | 2.41.0 | $timestamp |
string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null
Carbon
Create a Carbon instance from a timestamp in milliseconds.
Timestamp input can be given as int, float or a string containing one or more numbers.
Prototype changed | 3.0.0 | string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null |
Method added | 1.23.0 | $timestamp, $tz = null |
string|int|float $timestamp
Carbon
Set the instance's timestamp.
Timestamp input can be given as int, float or a string containing one or more numbers.
Prototype changed | 3.0.0 | string|int|float $timestamp |
Prototype changed | 2.41.0 | $unixTimestamp |
Method added | 1.0.0 | $value |
$precision = 6
float
Returns a timestamp rounded with the given precision (6 by default).
Examples:
getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)
getPreciseTimestamp(6) 1532087464437474
getPreciseTimestamp(5) 153208746443747 (1/100000 second precision)
getPreciseTimestamp(4) 15320874644375 (1/10000 second precision)
getPreciseTimestamp(3) 1532087464437 (millisecond precision)
getPreciseTimestamp(2) 153208746444 (1/100 second precision)
getPreciseTimestamp(1) 15320874644 (1/10 second precision)
getPreciseTimestamp(0) 1532087464 (second precision)
getPreciseTimestamp(-1) 153208746 (10 second precision)
getPreciseTimestamp(-2) 15320875 (100 second precision)
Method added | 2.0.0 | $precision = 6 |
float
Returns the milliseconds timestamps used amongst other by Date javascript objects.
Method added | 2.0.0 | no arguments |
int
Returns the timestamp with millisecond precision.
Method added | 2.51.0 | no arguments |
int
@alias getTimestamp
Returns the UNIX timestamp for the current date.
Method added | 2.0.0 | no arguments |
string $unit, $value = 1
Carbon
Prototype changed | 3.0.0 | string $unit, $value = 1 |
Method added | 2.0.0 | $unit, $value = 1 |
string $unit, $value = 1
Carbon
Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past.
Method added | 3.2.0 | string $unit, $value = 1 |
$unit, $value = 1
Carbon
Method added | 2.0.0 | $unit, $value = 1 |
$unit, $value = 1
Carbon
Subtract seconds to the instance using timestamp. Positive $value travels into the past while negative $value travels forward.
Method added | 3.2.0 | $unit, $value = 1 |
$unit
bool
Returns true if a property can be changed via setter.
Method added | 2.0.0 | $unit |
DateInterval $interval
Carbon
Call native PHP DateTime/DateTimeImmutable add() method.
Method added | 2.36.0 | DateInterval $interval |
Carbon\Unit|string $unit, $value = 1, ?bool $overflow = null
Carbon
Add given units to the current instance.
Prototype changed | 3.1.0 | Carbon\Unit|string $unit, $value = 1, ?bool $overflow = null |
Prototype changed | 3.0.0 | string $unit, $value = 1, ?bool $overflow = null |
Method added | 2.0.0 | $unit, $value = 1, $overflow = null |
Carbon\Unit|string $unit, $value = 1, ?bool $overflow = null
Carbon
Subtract given units to the current instance.
Prototype changed | 3.1.0 | Carbon\Unit|string $unit, $value = 1, ?bool $overflow = null |
Prototype changed | 3.0.0 | string $unit, $value = 1, ?bool $overflow = null |
Method added | 2.0.0 | $unit, $value = 1, $overflow = null |
DateInterval $interval
Carbon
Call native PHP DateTime/DateTimeImmutable sub() method.
Method added | 2.36.0 | DateInterval $interval |
$unit, $value = 1, ?bool $overflow = null
Carbon
Subtract given units or interval to the current instance.
Prototype changed | 3.0.0 | $unit, $value = 1, ?bool $overflow = null |
Method added | 2.0.0 | $unit, $value = 1, $overflow = null |
$year = null, $dayOfWeek = null, $dayOfYear = null
int|Carbon
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.
Method added | 2.0.0 | $year = null, $dayOfWeek = null, $dayOfYear = null |
$year = null, $dayOfWeek = null, $dayOfYear = null
int|Carbon
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).
Method added | 2.0.0 | $year = null, $dayOfWeek = null, $dayOfYear = null |
$dayOfWeek = null, $dayOfYear = null
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.
Method added | 2.0.0 | $dayOfWeek = null, $dayOfYear = null |
$dayOfWeek = null, $dayOfYear = null
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).
Method added | 2.0.0 | $dayOfWeek = null, $dayOfYear = null |
$week = null, $dayOfWeek = null, $dayOfYear = null
int|Carbon
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).
Method added | 2.0.0 | $week = null, $dayOfWeek = null, $dayOfYear = null |
$week = null, $dayOfWeek = null, $dayOfYear = null
int|Carbon
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.
Method added | 2.0.0 | $week = null, $dayOfWeek = null, $dayOfYear = null |
string
Returns day English name in lower case.
Spatie\OpeningHours\OpeningHours
Returns an OpeningHours instance (the one given if already an instance of OpeningHours, or else create a new one from array definition given).
$this|null
Set the opening hours for the class/instance.
$this|null
Reset the opening hours for the class/instance.
Spatie\OpeningHours\OpeningHours
Get the opening hours of the class/instance.
mixed
Call a method on the OpeningHours of the current instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
Carbon|CarbonImmutable|CarbonInterface
Add a given number of business days to the current date.
int
Returns the difference between 2 dates in business days.
int
Get the number of business days in the current month.
array
Get list of date objects for each business day in the current month.
$this|null
Checks the date to see if it is a business day (neither a weekend day nor a holiday).
bool
Checks the date to see if it is a business day (extra workday or neither a weekend day nor a holiday).
CarbonInterface|Carbon|CarbonImmutable
Sets the date to the next business day (neither a weekend day nor a holiday).
CarbonInterface|Carbon|CarbonImmutable
Sets the date to the current or next business day (neither a weekend day nor a holiday).
CarbonInterface|Carbon|CarbonImmutable
Sets the date to the next business day (neither a weekend day nor a holiday).
CarbonInterface|Carbon|CarbonImmutable
Sets the date to the current or next business day (neither a weekend day nor a holiday).
$this|null
Set the selected zone for observed holidays. So next observe methods will be saved and considered in this given custom zone.
string|null
Get the selected zone for observed holidays.
$this|null
Set a holiday as observed/unobserved in the selected zone.
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
$this|null
Set a holiday as observed/unobserved in the selected zone (can take array of holidays).
bool
Check if a given holiday ID is observed in the selected zone.
bool
Checks the date to see if it is a holiday observed in the selected zone.
$this|null
Set the strategy to get the holiday ID from a date object.
$this|null
Set the strategy to get the extra workday ID from a date object.
string|false
Get the identifier of the current holiday or false if it's not a holiday.
string|false
Get the identifier of the current holiday or false if it's not a holiday.
bool
Checks the date to see if it is a holiday.
string|false
Get the identifier of the current special workday or false if it's not a special workday.
bool
Checks the date to see if it is a holiday.
array
Get the holidays in the given language.
string|false
Get the name of the current holiday (using the locale given in parameter or the current date locale) or false if it's not a holiday.
array
Get the holidays dates for a given year (current year if no parameter given).
callable
Get a next() callback to call to iterate over holidays of a year.
string
Return a standardized region name.
array
Get the current holidays region.
Set the holidays region (see src/Cmixin/Holidays for examples).
null|string
Get the current holidays region.
array
Get the holidays for the current region selected.
array
Get the holidays for the current region selected.
array
Get the holidays for the current region selected.
Carbon|CarbonImmutable|CarbonInterface|null
Push a day into a given list list of a region.
Carbon|CarbonImmutable|CarbonInterface|null
Push a holiday to the holidays list of a region.
Carbon|CarbonImmutable|CarbonInterface|null
Push a workday to the workdays list of a region.
Carbon|CarbonImmutable|CarbonInterface|null
Set/change the name of holiday by ID for a given language (or a list of languages).
Carbon|CarbonImmutable|CarbonInterface|null
Add a holiday to the holidays list of a region and optionally init its ID, name and observed state.
Carbon|CarbonImmutable|CarbonInterface|null
Add a workday to the workdays list of a region and optionally init its ID and name.
array
Unpack a holiday array definition.
array
Check a holiday definition and unpack it if it's an array.
Add a holiday to the holidays list of a region and optionally init their IDs, names and observed states (if provided as array-definitions).
bool
Return true if the given value is a DateTime or DateTimeInterface.
array
Store a first variable as Carbon instance into the second variable if the first one is a date.
@codeCoverageIgnore
bool
array
Get stored data set for the a given holiday ID.
$this|null
Set stored data set for the a given holiday ID.
array
Get stored data set for the current holiday or null if it's not a holiday.
$this|null
Set stored data set for the current holiday, does nothing if it's not a holiday.
Set the maximum of loop turns to run before throwing an exception where trying to add or subtract open/closed time.
int
Get the maximum of loop turns to run before throwing an exception where trying to add or subtract open/closed time.
Carbon|CarbonImmutable|CarbonInterface
Shift current time with a given interval taking into account only open time (if $open is true) or only closed time (if $open is false).
Carbon|CarbonImmutable|CarbonInterface
Add the given interval taking into account only open time (if $open is true) or only closed time (if $open is false).
Carbon|CarbonImmutable|CarbonInterface
Add the given interval taking into account only open time (if $open is true) or only closed time (if $open is false).
Carbon|CarbonImmutable|CarbonInterface
Add the given interval taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given interval taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Add the given interval taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given interval taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Add the given number of minutes taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given number of minutes taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Add the given number of minutes taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given number of minutes taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Add the given number of hours taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given number of hours taking into account only open time.
Carbon|CarbonImmutable|CarbonInterface
Add the given number of hours taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Subtract the given number of hours taking into account only closed time.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
CarbonInterval|float
Return an interval/count of given unit with open/closed business time between the current date and an other given date.
CarbonInterval
Return an interval with open/closed business time between the current date and an other given date.
float
Return a number of seconds with open/closed business time between the current date and an other given date.
float
Return a number of minutes with open/closed business time between the current date and an other given date.
float
Return a number of hours with open/closed business time between the current date and an other given date.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
Carbon|CarbonImmutable|CarbonInterface
Loop on the current instance (or now if called statically) with a given method until it's not a holiday.
bool
Returns true if the business is open on a given day according to current opening hours.
bool
Returns true if the business is open on a given day according to current opening hours.
bool
Returns true if the business is open now (or current date and time) according to current opening hours. /!\ Important: it returns true if the current day is a holiday unless you set a closure handler for it in the exceptions setting.
bool
Returns true if the business is open now (or current date and time) according to current opening hours. /!\ Important: it returns true if the current day is a holiday unless you set a closure handler for it in the exceptions setting.
bool
Returns true if the business is open and not a holiday now (or current date and time) according to current opening hours.
bool
Returns true if the business is open and not a holiday now (or current date and time) according to current opening hours.
bool
Returns true if the business is closed or a holiday now (or current date and time) according to current opening hours.
bool
Returns true if the business is closed or a holiday now (or current date and time) according to current opening hours.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Carbon|CarbonImmutable|CarbonInterface
Get a method that return current date-time if $testMethod applied on it return true, else return the result of $method called on it.
Spatie\OpeningHours\OpeningHoursForDay
Get OpeningHoursForDay instance of the current instance or class.
Spatie\OpeningHours\TimeRange[]
Get open time ranges as array of TimeRange instances that matches the current date and time.
Spatie\OpeningHours\TimeRange|bool
Get current open time range as TimeRange instance or false if closed.
CarbonPeriod|bool
Get current open time range as TimeRange instance or false if closed.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Carbon|CarbonImmutable|CarbonInterface|bool
Get a closure to be executed on OpeningHours on the current instance (or now if called globally) that should return a date, then convert it into a Carbon/sub-class instance.
Season\SeasonEnum
Return the season of the current date.
bool
Return either current date is in spring.
bool
Return either current date is in summer.
bool
Return either current date is in fall.
bool
Return either current date is in winter.
DateTimeZone|string|int $timezone
CarbonInterval
Set the instance's timezone from a string or object.
Prototype changed | 3.0.0 | DateTimeZone|string|int $timezone |
Method added | 2.52.0 | $tzName |
DateTimeZone|string|int $timezone
CarbonInterval
Set the instance's timezone from a string or object and add/subtract the offset difference.
Prototype changed | 3.0.0 | DateTimeZone|string|int $timezone |
Method added | 2.3.0 | $tzName |
array
Mapping of units and factors for cascading.
Should only be modified by changing the factors or referenced constants.
Method added | 1.28.0 | no arguments |
array $cascadeFactors
Set default cascading factors for ->cascade() method.
Method added | 1.28.0 | array $cascadeFactors |
bool $floatSettersEnabled = true
This option allow you to opt-in for the Carbon 3 behavior where float
values will no longer be cast to integer (so truncated).
⚠️ This settings will be applied globally, which mean your whole application
code including the third-party dependencies that also may use Carbon will
adopt the new behavior.
Method added | 2.70.0 | bool $floatSettersEnabled = true |
$years = null, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null
Create a new CarbonInterval instance.
Prototype changed | 3.0.0 | $years = null, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null |
Prototype changed | 2.0.0 | $years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null |
Method added | 1.18.0 | $years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null |
$source, $target
int|float|null
Returns the factor for a given source-to-target couple.
Method added | 1.28.0 | $source, $target |
$source, $target
int|float|null
Returns the factor for a given source-to-target couple if set, else try to find the appropriate constant as the factor, such as Carbon::DAYS_PER_WEEK.
Method added | 2.55.0 | $source, $target |
int|float
Returns current config for days per week.
Method added | 1.28.0 | no arguments |
int|float
Returns current config for hours per day.
Method added | 1.28.0 | no arguments |
int|float
Returns current config for minutes per hour.
Method added | 2.0.0 | no arguments |
int|float
Returns current config for seconds per minute.
Method added | 2.0.0 | no arguments |
int|float
Returns current config for microseconds per second.
Method added | 2.0.0 | no arguments |
int|float
Returns current config for microseconds per second.
Method added | 2.0.0 | no arguments |
$years = null, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null
CarbonInterval
Create a new CarbonInterval instance from specific values. This is an alias for the constructor that allows better fluent syntax as it allows you to do CarbonInterval::create(1)->fn() rather than (new CarbonInterval(1))->fn().
Prototype changed | 3.0.0 | $years = null, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null |
Prototype changed | 2.5.0 | $years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null |
Method added | 1.18.0 | $years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null |
string $format, ?string $interval
CarbonInterval
Parse a string into a new CarbonInterval object according to the specified format.
Examples:
echo Carboninterval::createFromFormat('H:i', '1:30');
Method added | 2.27.0 | string $format, ?string $interval |
array|int|string|DateInterval|mixed|null
Return the original source used to create the current interval.
Method added | 3.0.0 | no arguments |
CarbonInterface
Return the start date if interval was created from a difference between 2 dates.
Method added | 3.0.0 | no arguments |
CarbonInterface
Return the end date if interval was created from a difference between 2 dates.
Method added | 3.0.0 | no arguments |
CarbonInterval
Get rid of the original input, start date and end date that may be kept in memory.
Method added | 3.0.0 | no arguments |
CarbonInterval
Get a copy of the instance.
Method added | 1.28.0 | no arguments |
CarbonInterval
Get a copy of the instance.
Method added | 2.22.0 | no arguments |
$dump
CarbonInterval
Evaluate the PHP generated by var_export() and recreate the exported CarbonInterval instance.
Prototype changed | 2.71.0 | $dump |
Method added | 1.18.0 | array $array |
string $intervalDefinition
CarbonInterval
Creates a CarbonInterval from string.
Format:
Suffix | Unit | Example | DateInterval expression
-------|---------|---------|------------------------
y | years | 1y | P1Y
mo | months | 3mo | P3M
w | weeks | 2w | P2W
d | days | 28d | P28D
h | hours | 4h | PT4H
m | minutes | 12m | PT12M
s | seconds | 59s | PT59S
e. g. `1w 3d 4h 32m 23s` is converted to 10 days 4 hours 32 minutes and 23 seconds.
Special cases:
- An empty string will return a zero interval
- Fractions are allowed for weeks, days, hours and minutes and will be converted
and rounded to the next smaller value (caution: 0.5w = 4d)
Prototype changed | 3.0.0 | string $intervalDefinition |
Method added | 1.25.0 | $intervalDefinition |
string $interval, ?string $locale = null
CarbonInterval
Creates a CarbonInterval from string using a different locale.
Prototype changed | 3.0.0 | string $interval, ?string $locale = null |
Prototype changed | 2.35.0 | $interval, $locale = null |
Method added | 2.21.0 | $interval, $locale |
$start, $end = null, bool $absolute = false, array $skip = []
CarbonInterval
Create an interval from the difference between 2 dates.
Method added | 3.0.0 | $start, $end = null, bool $absolute = false, array $skip = [] |
bool $absolute = false
CarbonInterval
Invert the interval if it's inverted.
Method added | 3.0.0 | bool $absolute = false |
bool $absolute = true
CarbonInterval
@alias abs
Invert the interval if it's inverted.
Method added | 3.0.0 | bool $absolute = true |
string $className
mixed
Cast the current instance into the given class.
Method added | 2.23.0 | string $className |
DateInterval $interval, array $skip = [], bool $skipCopy = false
CarbonInterval
Create a CarbonInterval instance from a DateInterval one. Can not instance DateInterval objects created from DateTime::diff() as you can't externally set the $days field.
Prototype changed | 2.70.0 | DateInterval $interval, array $skip = [], bool $skipCopy = false |
Prototype changed | 2.64.0 | DateInterval $interval, array $skip = [] |
Prototype changed | 2.21.0 | DateInterval $interval |
Prototype changed | 2.0.0 | DateInterval $di |
Prototype changed | 1.35.0 | DateInterval $di, $trimMicroseconds = true |
Method added | 1.18.0 | DateInterval $di |
$interval, $unit = null, bool $skipCopy = false
CarbonInterval
Make a CarbonInterval instance from given variable if possible.
Always return a new instance. Parse only strings and only these likely to be intervals (skip dates
and recurrences). Throw an exception for invalid format, but otherwise return null.
Prototype changed | 2.70.0 | $interval, $unit = null, bool $skipCopy = false |
Prototype changed | 2.34.0 | $interval, $unit = null |
Method added | 1.28.0 | $var |
string $datetime
CarbonInterval
Sets up a DateInterval from the relative parts of the string.
Prototype changed | 3.0.0 | string $datetime |
Prototype changed | 2.0.0 | $time |
Prototype changed | 1.21.0 | string $datetime |
Method added | 1.18.0 | $time |
Carbon\Unit|string $name
string|int|float|null
Get a part of the CarbonInterval object.
Prototype changed | 3.1.0 | Carbon\Unit|string $name |
Prototype changed | 3.0.0 | string $name |
Method added | 2.37.0 | $name |
string $name
string|int|float|null
Get a part of the CarbonInterval object.
Prototype changed | 3.0.0 | string $name |
Method added | 1.18.0 | $name |
$name, $value = null
CarbonInterval
Set a part of the CarbonInterval object.
Method added | 2.37.0 | $name, $value = null |
string $name, $value
Set a part of the CarbonInterval object.
Prototype changed | 3.0.0 | string $name, $value |
Prototype changed | 2.0.0 | $name, $value |
Method added | 1.18.0 | $name, $val |
int $weeks, int $days
CarbonInterval
Allow setting of weeks and days to be cumulative.
Prototype changed | 3.0.0 | int $weeks, int $days |
Method added | 1.18.0 | $weeks, $days |
bool
Returns true if the interval is empty for each unit.
Method added | 2.0.0 | no arguments |
string $name, ?callable $macro
Register a custom macro.
Pass null macro to remove it.
Examples:
CarbonInterval::macro('twice', function () {
return $this->times(2);
});
echo CarbonInterval::hours(2)->twice();
Prototype changed | 3.0.1 | string $name, ?callable $macro |
Prototype changed | 3.0.0 | string $name, $macro |
Method added | 1.28.0 | $name, $macro |
$mixin
Register macros from a mixin object.
Examples:
CarbonInterval::mixin(new class {
public function daysToHours() {
return function () {
$this->hours += $this->days;
$this->days = 0;
return $this;
};
}
public function hoursToDays() {
return function () {
$this->days += $this->hours;
$this->hours = 0;
return $this;
};
}
});
echo CarbonInterval::hours(5)->hoursToDays() . "\n";
echo CarbonInterval::days(5)->daysToHours() . "\n";
Method added | 1.28.0 | $mixin |
string $name
bool
Check if macro is registered.
Prototype changed | 3.0.0 | string $name |
Method added | 1.28.0 | $name |
array
Returns interval values as an array where key are the unit names and values the counts.
Method added | 2.27.0 | no arguments |
array
Returns interval non-zero values as an array where key are the unit names and values the counts.
Method added | 2.27.0 | no arguments |
array
Returns interval values as an array where key are the unit names and values the counts from the biggest non-zero one the the smallest non-zero one.
Method added | 2.27.0 | no arguments |
$syntax = null, $short = false, $parts = -1, $options = null
string
Get the current interval in a human readable format in the current locale.
Examples:
echo CarbonInterval::fromString('4d 3h 40m')->forHumans() . "\n";
echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 2]) . "\n";
echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 3, 'join' => true]) . "\n";
echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['short' => true]) . "\n";
echo CarbonInterval::fromString('1d 24h')->forHumans(['join' => ' or ']) . "\n";
echo CarbonInterval::fromString('1d 24h')->forHumans(['minimumUnit' => 'hour']) . "\n";
Prototype changed | 2.0.0 | $syntax = null, $short = false, $parts = -1, $options = null |
Prototype changed | 1.28.0 | $short = false |
Method added | 1.18.0 | no arguments |
string $format
string
Returns the formatted date string on success or FALSE on failure.
Prototype changed | 1.21.0 | string $format |
Method added | 1.18.0 | $format |
string
Format the instance as a string using the forHumans() function.
Method added | 1.18.0 | no arguments |
DateInterval
Return native DateInterval PHP object matching the current instance.
Examples:
\Carbon\Doc\Generate\var_dump(CarbonInterval::hours(2)->toDateInterval());
Method added | 2.23.0 | no arguments |
$params
CarbonPeriod
Convert the interval to a CarbonPeriod.
Prototype changed | 2.0.0 | $params |
Method added | 1.29.0 | no arguments |
$interval, Carbon\Unit|string|null $unit = null
CarbonPeriod
Decompose the current interval into
Method added | 3.0.0 | $interval, Carbon\Unit|string|null $unit = null |
$inverted = null
CarbonInterval
Invert the interval.
Prototype changed | 2.37.0 | $inverted = null |
Method added | 1.28.0 | no arguments |
$unit, $value = 1
CarbonInterval
Add the passed interval to the current instance.
Prototype changed | 2.4.0 | $unit, $value = 1 |
Method added | 1.18.0 | DateInterval $interval |
$unit, $value = 1
CarbonInterval
Subtract the passed interval to the current instance.
Method added | 2.4.0 | $unit, $value = 1 |
$unit, $value = 1
CarbonInterval
Subtract the passed interval to the current instance.
Method added | 2.4.0 | $unit, $value = 1 |
$years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0
CarbonInterval
Add given parameters to the current interval.
Method added | 2.45.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
$years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0
CarbonInterval
Add given parameters to the current interval.
Method added | 2.45.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
$factor
CarbonInterval
Multiply current instance given number of times. times() is naive, it multiplies each unit
(so day can be greater than 31, hour can be greater than 23, etc.) and the result is rounded
separately for each unit.
Use times() when you want a fast and approximated calculation that does not cascade units.
For a precise and cascaded calculation,
Method added | 1.27.0 | $factor |
$factor
CarbonInterval
Multiply and cascade current instance by a given factor.
Method added | 2.20.0 | $factor |
$divider
CarbonInterval
Divide and cascade current instance by a given divider.
Method added | 2.20.0 | $divider |
DateInterval $interval, bool $microseconds = false, array $skip = []
string
Get the interval_spec string of a date interval.
Prototype changed | 2.64.0 | DateInterval $interval, bool $microseconds = false, array $skip = [] |
Prototype changed | 2.61.0 | DateInterval $interval, bool $microseconds = false |
Method added | 1.26.0 | DateInterval $interval |
bool $microseconds = false
string
Get the interval_spec string.
Prototype changed | 2.61.0 | bool $microseconds = false |
Method added | 1.22.0 | no arguments |
DateInterval $first, DateInterval $second
int
Comparing 2 date intervals.
Prototype changed | 2.21.0 | DateInterval $first, DateInterval $second |
Method added | 1.26.0 | DateInterval $a, DateInterval $b |
DateInterval $interval
int
Comparing with passed interval.
Method added | 1.24.0 | DateInterval $interval |
CarbonInterval
Convert overflowed values into bigger units.
Method added | 1.28.0 | no arguments |
bool
Method added | 2.37.0 | no arguments |
bool
Method added | 2.37.0 | no arguments |
string $unit
float
Get amount of given unit equivalent to the interval.
Prototype changed | 3.0.0 | string $unit |
Method added | 1.28.0 | $unit |
$interval
bool
Determines if the instance is equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is not equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is not equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is greater (longer) than another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is greater (longer) than another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is greater (longer) than or equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is greater (longer) than or equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is less (shorter) than another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is less (shorter) than another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is less (shorter) than or equal to another
Method added | 2.22.0 | $interval |
$interval
bool
Determines if the instance is less (shorter) than or equal to another
Method added | 2.22.0 | $interval |
$interval1, $interval2, bool $equal = 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.
Examples:
CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(3)); // true
CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::hours(36)); // false
CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2)); // true
CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2), false); // false
Prototype changed | 3.0.0 | $interval1, $interval2, bool $equal = true |
Method added | 2.22.0 | $interval1, $interval2, $equal = true |
$interval1, $interval2
bool
Determines if the instance is between two others, bounds excluded.
Examples:
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // true
Method added | 2.31.0 | $interval1, $interval2 |
$interval1, $interval2
bool
Determines if the instance is between two others, bounds excluded.
Examples:
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false
CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // false
Method added | 2.22.0 | $interval1, $interval2 |
$interval1, $interval2, bool $equal = true
bool
Determines if the instance is between two others
Examples:
CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(3)); // true
CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::hours(36)); // false
CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2)); // true
CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2), false); // false
Prototype changed | 3.0.0 | $interval1, $interval2, bool $equal = true |
Method added | 2.22.0 | $interval1, $interval2, $equal = true |
string $unit, DateInterval|string|int|float $precision = 1, string $function = 'round'
CarbonInterval
Round the current instance at the given unit with given precision if specified and the given function.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float $precision = 1, string $function = 'round' |
Method added | 2.23.0 | $unit, $precision = 1, $function = 'round' |
string $unit, $precision = 1
CarbonInterval
Truncate the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, $precision = 1 |
Method added | 2.23.0 | $unit, $precision = 1 |
string $unit, $precision = 1
CarbonInterval
Ceil the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, $precision = 1 |
Method added | 2.23.0 | $unit, $precision = 1 |
$precision = 1, string $function = 'round'
CarbonInterval
Round the current instance second with given precision if specified.
Prototype changed | 3.0.0 | $precision = 1, string $function = 'round' |
Method added | 2.23.0 | $precision = 1, $function = 'round' |
DateInterval|string|int|float $precision = 1
CarbonInterval
Round the current instance second with given precision if specified.
Prototype changed | 3.0.0 | DateInterval|string|int|float $precision = 1 |
Method added | 2.23.0 | $precision = 1 |
DateInterval|string|int|float $precision = 1
CarbonInterval
Ceil the current instance second with given precision if specified.
Prototype changed | 3.0.0 | DateInterval|string|int|float $precision = 1 |
Method added | 2.23.0 | $precision = 1 |
array $data
Set locale if specified on unserialize() called.
Only used by PHP >= 7.4.
Method added | 1.21.0 | array $data |
array
WrapperClock
Method added | 3.0.0 | no arguments |
Closure
Get the dynamic step in use.
Method added | 2.36.0 | no arguments |
?Closure $step
Set a step to apply instead of a fixed interval to get the new date.
Or pass null to switch to fixed interval.
Method added | 2.36.0 | ?Closure $step |
DateTimeInterface $dateTime, bool $negated = false
CarbonInterface
Take a date and apply either the step if set, or the current interval else.
The interval/step is applied negatively (typically subtraction instead of addition) if $negated is true.
Method added | 2.36.0 | DateTimeInterface $dateTime, bool $negated = false |
object|string $mixin
Mix another object into the class.
Examples:
Carbon::mixin(new class {
public function addMoon() {
return function () {
return $this->addDays(30);
};
}
public function subMoon() {
return function () {
return $this->subDays(30);
};
}
});
$fullMoon = Carbon::create('2018-12-22');
$nextFullMoon = $fullMoon->addMoon();
$blackMoon = Carbon::create('2019-01-06');
$previousBlackMoon = $blackMoon->subMoon();
echo "$nextFullMoon\n";
echo "$previousBlackMoon\n";
Prototype changed | 3.0.0 | object|string $mixin |
Method added | 2.23.0 | $mixin |
array $settings
CarbonInterval
Set specific options. - strictMode: true|false|null - monthOverflow: true|false|null - yearOverflow: true|false|null - humanDiffOptions: int|null - toStringFormat: string|Closure|null - toJsonFormat: string|Closure|null - locale: string|null - timezone: \DateTimeZone|string|int|null - macros: array|null - genericMacros: array|null
Method added | 2.0.0 | array $settings |
array
Returns current local settings.
Method added | 2.3.0 | no arguments |
array
Show truthy properties on \Carbon\Doc\Generate\var_dump().
Method added | 2.17.0 | no arguments |
bool $strictModeEnabled = true
Prototype changed | 3.0.0 | bool $strictModeEnabled = true |
Method added | 2.0.0 | $strictModeEnabled = true |
bool
Returns true if the strict mode is globally in use, false else. (It can be overridden in specific instances.)
Method added | 2.0.0 | no arguments |
bool $monthsOverflow = true
Prototype changed | 3.0.0 | bool $monthsOverflow = true |
Method added | 2.0.0 | $monthsOverflow = true |
Method added | 2.0.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 2.0.0 | no arguments |
bool $yearsOverflow = true
Prototype changed | 3.0.0 | bool $yearsOverflow = true |
Method added | 2.0.0 | $yearsOverflow = true |
Method added | 2.0.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 2.0.0 | no arguments |
bool
Return true if the current instance has its own translator.
Method added | 2.29.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface
Get the translator of the current instance or the default if none set.
Method added | 2.0.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
CarbonInterval
Set the translator for the current instance.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 2.0.0 | Symfony\Component\Translation\TranslatorInterface $translator |
$translator, string $key, ?string $locale = null, ?string $default = null
string|Closure|null
Returns raw translation message for a given key.
Method added | 2.8.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
string $key, ?string $locale = null, ?string $default = null, $translator = null
string
Returns raw translation message for a given key.
Method added | 2.8.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
Method added | 2.8.0 | Symfony\Component\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null |
int $number
string
Returns the alternative number for a given integer if available in the current locale.
Method added | 2.23.0 | int $number |
string $timeString, ?string $from = null, ?string $to = null, int $mode = 31
string
Translate a time string from a locale to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $from = null, ?string $to = null, int $mode = 31 |
Prototype changed | 2.35.0 | $timeString, $from = null, $to = null, $mode = 31 |
Method added | 2.16.0 | $timeString, $from = null, $to = null, $mode = 15 |
string $timeString, ?string $to = null
string
Translate a time string from the current locale (`$date->locale()`) to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $to = null |
Method added | 2.16.0 | $timeString, $to = null |
?string $locale = null, string $fallbackLocales
CarbonInterval|string
Get/set the locale for the current instance.
Prototype changed | 3.0.0 | ?string $locale = null, string $fallbackLocales |
Prototype changed | 2.16.0 | ?string $locale = null, $fallbackLocales |
Method added | 2.0.0 | ?string $locale = null |
string
Get the current translator locale.
Method added | 1.18.0 | no arguments |
string $locale
Set the current translator locale and indicate if the source locale file exists. Pass 'auto' as locale to use the closest language to the current LC_TIME locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 1.18.0 | $locale |
string $locale
Set the fallback locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.16.0 | $locale |
string
Get the fallback locale.
Method added | 2.16.0 | no arguments |
string $locale, callable $func
mixed
Set the current locale to the given, execute the passed function, reset the locale to previous one, then return the result of the closure (or null if the closure was void).
Prototype changed | 3.0.0 | string $locale, callable $func |
Method added | 2.0.0 | $locale, $func |
string $locale
bool
Returns true if the given locale is internally supported and has short-units support. Support is considered enabled if either year, day or hour has a short variant translated.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). Support is considered enabled if the 4 sentences are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). Support is considered enabled if the 3 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). Support is considered enabled if the 2 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
$locale
bool
Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). Support is considered enabled if the 4 sentences are translated in the given locale.
Method added | 2.0.0 | $locale |
array
Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)
Method added | 2.0.0 | no arguments |
Language[]
Returns list of Language object for each available locale. This object allow you to get the ISO name, native name, region and variant of the locale.
Method added | 2.10.1 | no arguments |
int $humanDiffOptions
Prototype changed | 3.0.0 | int $humanDiffOptions |
Method added | 2.0.0 | $humanDiffOptions |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 2.0.0 | $humanDiffOption |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 2.0.0 | $humanDiffOption |
int
Return default humanDiff() options (merged flags as integer).
Method added | 2.0.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
Set the default translator instance to use.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 1.18.0 | Symfony\Component\Translation\TranslatorInterface $translator |
Symfony\Contracts\Translation\TranslatorInterface
Initialize the default translator instance if necessary.
Method added | 1.18.0 | no arguments |
Reset the format used to the default when type juggling a Carbon instance to a string
Method added | 2.63.0 | no arguments |
Closure|string|null $format
Prototype changed | 3.0.0 | Closure|string|null $format |
Method added | 2.63.0 | $format |
Generator
Method added | 3.0.0 | no arguments |
mixed $var
CarbonPeriod
Make a CarbonPeriod instance from given variable if possible.
Prototype changed | 3.0.0 | mixed $var |
Method added | 2.22.0 | $var |
mixed $period
CarbonPeriod
Create a new instance from a DatePeriod or CarbonPeriod object.
Prototype changed | 3.0.0 | mixed $period |
Method added | 2.22.0 | $period |
$params
CarbonPeriod
Create a new instance.
Prototype changed | 2.0.0 | $params |
Method added | 1.29.0 | no arguments |
array $params
CarbonPeriod
Create a new instance from an array of parameters.
Method added | 1.29.0 | array $params |
string $iso, ?int $options = null
CarbonPeriod
Create CarbonPeriod from ISO 8601 string.
Prototype changed | 3.0.0 | string $iso, ?int $options = null |
Method added | 1.29.0 | $iso, $options = null |
string $name, ?callable $macro
Register a custom macro.
Pass null macro to remove it.
Examples:
CarbonPeriod::macro('middle', function () {
return $this->getStartDate()->average($this->getEndDate());
});
echo CarbonPeriod::since('2011-05-12')->until('2011-06-03')->middle();
Prototype changed | 3.0.1 | string $name, ?callable $macro |
Prototype changed | 3.0.0 | string $name, $macro |
Method added | 1.29.0 | $name, $macro |
object|string $mixin
Register macros from a mixin object.
Examples:
CarbonPeriod::mixin(new class {
public function addDays() {
return function ($count = 1) {
return $this->setStartDate(
$this->getStartDate()->addDays($count)
)->setEndDate(
$this->getEndDate()->addDays($count)
);
};
}
public function subDays() {
return function ($count = 1) {
return $this->setStartDate(
$this->getStartDate()->subDays($count)
)->setEndDate(
$this->getEndDate()->subDays($count)
);
};
}
});
echo CarbonPeriod::create('2000-01-01', '2000-02-01')->addDays(5)->subDays(3);
Prototype changed | 3.0.0 | object|string $mixin |
Method added | 1.29.0 | $mixin |
string $name
bool
Check if macro is registered.
Prototype changed | 3.0.0 | string $name |
Method added | 1.29.0 | $name |
$arguments
CarbonPeriod constructor.
Prototype changed | 2.0.0 | $arguments |
Method added | 1.29.0 | no arguments |
CarbonPeriod
Get a copy of the instance.
Method added | 2.22.0 | no arguments |
string $name
bool|CarbonInterface|CarbonInterval|int|null
Get a property allowing both `DatePeriod` snakeCase and camelCase names.
Method added | 2.45.0 | string $name |
string $name
bool|CarbonInterface|CarbonInterval|int|null
Get a property allowing both `DatePeriod` snakeCase and camelCase names.
Method added | 2.41.0 | string $name |
string $name
bool
Check if an attribute exists on the object
Method added | 2.41.0 | string $name |
CarbonPeriod
@alias copy
Get a copy of the instance.
Method added | 2.22.0 | no arguments |
string $dateClass
CarbonPeriod
Set the iteration item class.
Method added | 2.0.0 | string $dateClass |
string
Returns iteration item date class.
Method added | 2.0.0 | no arguments |
mixed $interval, Carbon\Unit|string|null $unit = null
CarbonPeriod
Change the period date interval.
Prototype changed | 3.0.0 | mixed $interval, Carbon\Unit|string|null $unit = null |
Method added | 1.29.0 | $interval |
CarbonPeriod
Reset the date interval to the default value.
Difference with simply setting interval to 1-day is that P1D will not appear when calling toIso8601String()
and also next adding to the interval won't include the default 1-day.
Method added | 3.0.0 | no arguments |
CarbonPeriod
Invert the period date interval.
Method added | 1.29.0 | no arguments |
mixed $start, mixed $end
CarbonPeriod
Set start and end date.
Prototype changed | 3.0.0 | mixed $start, mixed $end |
Method added | 1.29.0 | $start, $end |
?int $options
CarbonPeriod
Change the period options.
Prototype changed | 3.0.0 | ?int $options |
Method added | 1.29.0 | $options |
int
Get the period options.
Method added | 1.29.0 | no arguments |
int $options, ?bool $state = null
CarbonPeriod
Toggle given options on or off.
Prototype changed | 3.0.0 | int $options, ?bool $state = null |
Method added | 1.29.0 | $options, $state = null |
bool $state = true
CarbonPeriod
Toggle EXCLUDE_START_DATE option.
Prototype changed | 3.0.0 | bool $state = true |
Method added | 1.29.0 | $state = true |
bool $state = true
CarbonPeriod
Toggle EXCLUDE_END_DATE option.
Prototype changed | 3.0.0 | bool $state = true |
Method added | 1.29.0 | $state = true |
CarbonInterval
Get the underlying date interval.
Method added | 1.29.0 | no arguments |
?string $rounding = null
CarbonInterface
Get start date of the period.
Prototype changed | 2.23.0 | ?string $rounding = null |
Method added | 1.29.0 | no arguments |
?string $rounding = null
CarbonInterface
Get end date of the period.
Prototype changed | 2.23.0 | ?string $rounding = null |
Method added | 1.29.0 | no arguments |
int|float|null
Get number of recurrences.
Method added | 1.29.0 | no arguments |
bool
Returns true if the start date should be excluded.
Method added | 1.29.0 | no arguments |
bool
Returns true if the end date should be excluded.
Method added | 1.29.0 | no arguments |
bool
Returns true if the start date should be included.
Method added | 2.23.0 | no arguments |
bool
Returns true if the end date should be included.
Method added | 2.23.0 | no arguments |
CarbonInterface
Return the start if it's included by option, else return the start + 1 period interval.
Method added | 2.23.0 | no arguments |
CarbonInterface
Return the end if it's included by option, else return the end - 1 period interval. Warning: if the period has no fixed end, this method will iterate the period to calculate it.
Method added | 2.23.0 | no arguments |
callable|string $callback, ?string $name = null
CarbonPeriod
Add a filter to the stack.
Prototype changed | 3.0.0 | callable|string $callback, ?string $name = null |
Method added | 1.29.0 | $callback, $name = null |
callable|string $callback, ?string $name = null
CarbonPeriod
Prepend a filter to the stack.
Prototype changed | 3.0.0 | callable|string $callback, ?string $name = null |
Method added | 1.29.0 | $callback, $name = null |
callable|string $filter
CarbonPeriod
Remove a filter by instance or name.
Prototype changed | 3.0.0 | callable|string $filter |
Method added | 1.29.0 | $filter |
callable|string $filter
bool
Return whether given instance or name is in the filter stack.
Prototype changed | 3.0.0 | callable|string $filter |
Method added | 1.29.0 | $filter |
array
Get filters stack.
Method added | 1.29.0 | no arguments |
array $filters
CarbonPeriod
Set filters stack.
Method added | 1.29.0 | array $filters |
CarbonPeriod
Reset filters stack.
Method added | 1.29.0 | no arguments |
int|float|null $recurrences
CarbonPeriod
Add a recurrences filter (set maximum number of recurrences).
Prototype changed | 3.0.0 | int|float|null $recurrences |
Method added | 1.29.0 | $recurrences |
mixed $date, ?bool $inclusive = null
CarbonPeriod
Change the period start date.
Prototype changed | 3.0.0 | mixed $date, ?bool $inclusive = null |
Method added | 1.29.0 | $date, $inclusive = null |
mixed $date, ?bool $inclusive = null
CarbonPeriod
Change the period end date.
Prototype changed | 3.0.0 | mixed $date, ?bool $inclusive = null |
Method added | 1.29.0 | $date, $inclusive = null |
bool
Check if the current position is valid.
Method added | 1.29.0 | no arguments |
int
Return the current key.
Method added | 1.29.0 | no arguments |
CarbonInterface
Return the current date.
Method added | 1.29.0 | no arguments |
Move forward to the next date.
Method added | 1.29.0 | no arguments |
Rewind to the start date.
Iterating over a date in the UTC timezone avoids bug during backward DST change.
Method added | 1.29.0 | no arguments |
int $count = 1
bool
Skip iterations and returns iteration state (false if ended, true if still valid).
Prototype changed | 3.0.0 | int $count = 1 |
Method added | 1.30.0 | $count = 1 |
string
Format the date period as ISO 8601.
Method added | 1.29.0 | no arguments |
string
Convert the date period into a string.
Method added | 1.29.0 | no arguments |
string
Format the date period as ISO 8601.
Method added | 1.29.0 | no arguments |
string $className
object
Cast the current instance into the given class.
Method added | 2.23.0 | string $className |
DatePeriod
Return native DatePeriod PHP object matching the current instance.
Examples:
\Carbon\Doc\Generate\var_dump(CarbonPeriod::create('2021-01-05', '2021-02-15')->toDatePeriod());
Method added | 2.23.0 | no arguments |
bool
Return `true` if the period has no custom filter and is guaranteed to be endless.
Note that we can't check if a period is endless as soon as it has custom filters
because filters can emit `CarbonPeriod::END_ITERATION` to stop the iteration in
a way we can't predict without actually iterating the period.
Method added | 2.59.0 | no arguments |
array
Convert the date period into an array without changing current iteration state.
Method added | 1.29.0 | no arguments |
int
Count dates in the date period.
Method added | 1.29.0 | no arguments |
CarbonInterface
Return the first date in the date period.
Method added | 1.29.0 | no arguments |
CarbonInterface
Return the last date in the date period.
Method added | 1.29.0 | no arguments |
string
Convert the date period into a string.
Method added | 1.29.0 | no arguments |
DateTimeZone|string|int $timezone
CarbonPeriod
Set the instance's timezone from a string or object and apply it to start/end.
Prototype changed | 3.0.0 | DateTimeZone|string|int $timezone |
Method added | 2.52.0 | $timezone |
DateTimeZone|string|int $timezone
CarbonPeriod
Set the instance's timezone from a string or object and add/subtract the offset difference to start/end.
Prototype changed | 3.0.0 | DateTimeZone|string|int $timezone |
Method added | 2.3.0 | $timezone |
?string $rounding = null
CarbonInterface
Returns the end is set, else calculated from start and recurrences.
Prototype changed | 2.23.0 | ?string $rounding = null |
Method added | 2.20.0 | no arguments |
mixed $rangeOrRangeStart, mixed $rangeEnd = null
bool
Returns true if the current period overlaps the given one (if 1 parameter passed) or the period between 2 dates (if 2 parameters passed).
Prototype changed | 3.0.0 | mixed $rangeOrRangeStart, mixed $rangeEnd = null |
Method added | 2.20.0 | $rangeOrRangeStart, $rangeEnd = null |
callable $callback
Execute a given function on each date of the period.
Examples:
Carbon::create('2020-11-29')->daysUntil('2020-12-24')->forEach(function (Carbon $date) {
echo $date->diffInDays('2020-12-25')." days before Christmas!\n";
});
Method added | 2.22.0 | callable $callback |
callable $callback
Generator
Execute a given function on each date of the period and yield the result of this function.
Examples:
$period = Carbon::create('2020-11-29')->daysUntil('2020-12-24');
echo implode("\n", iterator_to_array($period->map(function (Carbon $date) {
return $date->diffInDays('2020-12-25').' days before Christmas!';
})));
Method added | 2.22.0 | callable $callback |
mixed $period
bool
Determines if the instance is equal to another. Warning: if options differ, instances will never be equal.
Prototype changed | 3.0.0 | mixed $period |
Method added | 2.22.0 | $period |
mixed $period
bool
Determines if the instance is equal to another. Warning: if options differ, instances will never be equal.
Prototype changed | 3.0.0 | mixed $period |
Method added | 2.22.0 | $period |
mixed $period
bool
Determines if the instance is not equal to another. Warning: if options differ, instances will never be equal.
Prototype changed | 3.0.0 | mixed $period |
Method added | 2.22.0 | $period |
mixed $period
bool
Determines if the instance is not equal to another. Warning: if options differ, instances will never be equal.
Prototype changed | 3.0.0 | mixed $period |
Method added | 2.22.0 | $period |
mixed $date = null
bool
Determines if the start date is before another given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the start date is before or the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the start date is after another given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the start date is after or the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the start date is the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the end date is before another given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the end date is before or the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the end date is after another given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the end date is after or the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $date = null
bool
Determines if the end date is the same as a given date. (Rather start/end are included by options is ignored.)
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
bool
Return true if start date is now or later. (Rather start/end are included by options is ignored.)
Method added | 2.23.0 | no arguments |
bool
Return true if end date is now or later. (Rather start/end are included by options is ignored.)
Method added | 2.23.0 | no arguments |
bool
Return true if now is between start date (included) and end date (excluded). (Rather start/end are included by options is ignored.)
Method added | 2.23.0 | no arguments |
string $unit, DateInterval|string|int|float|null $precision = 1, callable|string $function = 'round'
CarbonPeriod
Round the current instance at the given unit with given precision if specified and the given function.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float|null $precision = 1, callable|string $function = 'round' |
Method added | 2.23.0 | $unit, $precision = 1, $function = 'round' |
string $unit, DateInterval|string|int|float|null $precision = 1
CarbonPeriod
Truncate the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float|null $precision = 1 |
Method added | 2.23.0 | $unit, $precision = 1 |
string $unit, DateInterval|string|int|float|null $precision = 1
CarbonPeriod
Ceil the current instance at the given unit with given precision if specified.
Prototype changed | 3.0.0 | string $unit, DateInterval|string|int|float|null $precision = 1 |
Method added | 2.23.0 | $unit, $precision = 1 |
DateInterval|string|int|float|null $precision = null, callable|string $function = 'round'
CarbonPeriod
Round the current instance second with given precision if specified (else period interval is used).
Prototype changed | 3.0.0 | DateInterval|string|int|float|null $precision = null, callable|string $function = 'round' |
Method added | 2.23.0 | $precision = null, $function = 'round' |
DateInterval|string|int|float|null $precision = null
CarbonPeriod
Round the current instance second with given precision if specified (else period interval is used).
Prototype changed | 3.0.0 | DateInterval|string|int|float|null $precision = null |
Method added | 2.23.0 | $precision = null |
DateInterval|string|int|float|null $precision = null
CarbonPeriod
Ceil the current instance second with given precision if specified (else period interval is used).
Prototype changed | 3.0.0 | DateInterval|string|int|float|null $precision = null |
Method added | 2.23.0 | $precision = null |
array
Specify data which should be serialized to JSON.
Method added | 2.23.0 | no arguments |
mixed $date = null
bool
Return true if the given date is between start and end.
Prototype changed | 3.0.0 | mixed $date = null |
Method added | 2.23.0 | $date = null |
mixed $period, mixed $arguments
bool
Return true if the current period follows a given other period (with no overlap). For instance, [2019-08-01 -> 2019-08-12] follows [2019-07-29 -> 2019-07-31] Note than in this example, follows() would be false if 2019-08-01 or 2019-07-31 was excluded by options.
Prototype changed | 3.0.0 | mixed $period, mixed $arguments |
Method added | 2.23.0 | $period, $arguments |
mixed $period, mixed $arguments
bool
Return true if the given other period follows the current one (with no overlap). For instance, [2019-07-29 -> 2019-07-31] is followed by [2019-08-01 -> 2019-08-12] Note than in this example, isFollowedBy() would be false if 2019-08-01 or 2019-07-31 was excluded by options.
Prototype changed | 3.0.0 | mixed $period, mixed $arguments |
Method added | 2.23.0 | $period, $arguments |
mixed $period, mixed $arguments
bool
Return true if the given period either follows or is followed by the current one.
Prototype changed | 3.0.0 | mixed $period, mixed $arguments |
Method added | 2.23.0 | $period, $arguments |
array
Show truthy properties on \Carbon\Doc\Generate\var_dump().
Method added | 2.17.0 | no arguments |
string $specification, int $options = 0
CarbonPeriod
Method added | 3.0.0 | string $specification, int $options = 0 |
array
Returns the values to dump on serialize() called on.
Only used by PHP >= 7.4.
Method added | 3.0.0 | no arguments |
array $data
Set locale if specified on unserialize() called.
Only used by PHP >= 7.4.
Method added | 3.0.0 | array $data |
Set locale if specified on unserialize() called.
Only used by PHP < 7.4.
Method added | 3.0.0 | no arguments |
array $array
CarbonPeriod
The __set_state handler.
Method added | 3.0.0 | array $array |
WrapperClock
Method added | 3.0.0 | no arguments |
object|string $mixin
Mix another object into the class.
Examples:
Carbon::mixin(new class {
public function addMoon() {
return function () {
return $this->addDays(30);
};
}
public function subMoon() {
return function () {
return $this->subDays(30);
};
}
});
$fullMoon = Carbon::create('2018-12-22');
$nextFullMoon = $fullMoon->addMoon();
$blackMoon = Carbon::create('2019-01-06');
$previousBlackMoon = $blackMoon->subMoon();
echo "$nextFullMoon\n";
echo "$previousBlackMoon\n";
Prototype changed | 3.0.0 | object|string $mixin |
Method added | 2.23.0 | $mixin |
array $settings
CarbonPeriod
Set specific options. - strictMode: true|false|null - monthOverflow: true|false|null - yearOverflow: true|false|null - humanDiffOptions: int|null - toStringFormat: string|Closure|null - toJsonFormat: string|Closure|null - locale: string|null - timezone: \DateTimeZone|string|int|null - macros: array|null - genericMacros: array|null
Method added | 2.0.0 | array $settings |
array
Returns current local settings.
Method added | 2.3.0 | no arguments |
array
Show truthy properties on \Carbon\Doc\Generate\var_dump().
Method added | 3.0.0 | no arguments |
bool $strictModeEnabled = true
Prototype changed | 3.0.0 | bool $strictModeEnabled = true |
Method added | 2.0.0 | $strictModeEnabled = true |
bool
Returns true if the strict mode is globally in use, false else. (It can be overridden in specific instances.)
Method added | 2.0.0 | no arguments |
bool $monthsOverflow = true
Prototype changed | 3.0.0 | bool $monthsOverflow = true |
Method added | 2.0.0 | $monthsOverflow = true |
Method added | 2.0.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 2.0.0 | no arguments |
bool $yearsOverflow = true
Prototype changed | 3.0.0 | bool $yearsOverflow = true |
Method added | 2.0.0 | $yearsOverflow = true |
Method added | 2.0.0 | no arguments |
bool
Get the month overflow global behavior (can be overridden in specific instances).
Method added | 2.0.0 | no arguments |
bool
Return true if the current instance has its own translator.
Method added | 2.29.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface
Get the translator of the current instance or the default if none set.
Method added | 2.0.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
CarbonPeriod
Set the translator for the current instance.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 2.0.0 | Symfony\Component\Translation\TranslatorInterface $translator |
$translator, string $key, ?string $locale = null, ?string $default = null
string|Closure|null
Returns raw translation message for a given key.
Method added | 2.8.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
string $key, ?string $locale = null, ?string $default = null, $translator = null
string
Returns raw translation message for a given key.
Method added | 2.8.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
Method added | 2.8.0 | Symfony\Component\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null |
string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
string
Translate using translation string or callback available.
Prototype changed | 3.0.0 | string $key, array $parameters = [], string|int|float|null $number = null, ?Symfony\Contracts\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null |
int $number
string
Returns the alternative number for a given integer if available in the current locale.
Method added | 2.23.0 | int $number |
string $timeString, ?string $from = null, ?string $to = null, int $mode = 31
string
Translate a time string from a locale to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $from = null, ?string $to = null, int $mode = 31 |
Prototype changed | 2.35.0 | $timeString, $from = null, $to = null, $mode = 31 |
Method added | 2.16.0 | $timeString, $from = null, $to = null, $mode = 15 |
string $timeString, ?string $to = null
string
Translate a time string from the current locale (`$date->locale()`) to an other.
Prototype changed | 3.0.0 | string $timeString, ?string $to = null |
Method added | 2.16.0 | $timeString, $to = null |
?string $locale = null, string $fallbackLocales
CarbonPeriod|string
Get/set the locale for the current instance.
Prototype changed | 3.0.0 | ?string $locale = null, string $fallbackLocales |
Prototype changed | 2.16.0 | ?string $locale = null, $fallbackLocales |
Method added | 2.0.0 | ?string $locale = null |
string
Get the current translator locale.
Method added | 2.0.0 | no arguments |
string $locale
Set the current translator locale and indicate if the source locale file exists. Pass 'auto' as locale to use the closest language to the current LC_TIME locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
Set the fallback locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.16.0 | $locale |
string
Get the fallback locale.
Method added | 2.16.0 | no arguments |
string $locale, callable $func
mixed
Set the current locale to the given, execute the passed function, reset the locale to previous one, then return the result of the closure (or null if the closure was void).
Prototype changed | 3.0.0 | string $locale, callable $func |
Method added | 2.0.0 | $locale, $func |
string $locale
bool
Returns true if the given locale is internally supported and has short-units support. Support is considered enabled if either year, day or hour has a short variant translated.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). Support is considered enabled if the 4 sentences are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). Support is considered enabled if the 3 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
string $locale
bool
Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). Support is considered enabled if the 2 words are translated in the given locale.
Prototype changed | 3.0.0 | string $locale |
Method added | 2.0.0 | $locale |
$locale
bool
Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). Support is considered enabled if the 4 sentences are translated in the given locale.
Method added | 2.0.0 | $locale |
array
Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)
Method added | 2.0.0 | no arguments |
Language[]
Returns list of Language object for each available locale. This object allow you to get the ISO name, native name, region and variant of the locale.
Method added | 2.10.1 | no arguments |
int $humanDiffOptions
Prototype changed | 3.0.0 | int $humanDiffOptions |
Method added | 2.0.0 | $humanDiffOptions |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 2.0.0 | $humanDiffOption |
int $humanDiffOption
Prototype changed | 3.0.0 | int $humanDiffOption |
Method added | 2.0.0 | $humanDiffOption |
int
Return default humanDiff() options (merged flags as integer).
Method added | 2.0.0 | no arguments |
Symfony\Contracts\Translation\TranslatorInterface $translator
Set the default translator instance to use.
Prototype changed | 3.0.0 | Symfony\Contracts\Translation\TranslatorInterface $translator |
Method added | 2.0.0 | Symfony\Component\Translation\TranslatorInterface $translator |
Symfony\Contracts\Translation\TranslatorInterface
Initialize the default translator instance if necessary.
Method added | 2.0.0 | no arguments |
Reset the format used to the default when type juggling a Carbon instance to a string
Method added | 2.63.0 | no arguments |
Closure|string|null $format
Prototype changed | 3.0.0 | Closure|string|null $format |
Method added | 2.63.0 | $format |
string|int|float $timezone
Create a new Carbon instance.
Please see the testing aids section (specifically static::setTestNow())
for more on the possibility of this constructor returning a test instance.
Prototype changed | 3.0.0 | string|int|float $timezone |
Method added | 2.0.0 | $timezone = null |
string $className
mixed
Cast the current instance into the given class.
Method added | 2.23.0 | string $className |
DateTimeZone|string|int|false|null $object, DateTimeZone|string|int|false|null $objectDump = null
CarbonTimeZone
Create a CarbonTimeZone from mixed input.
Prototype changed | 3.0.0 | DateTimeZone|string|int|false|null $object, DateTimeZone|string|int|false|null $objectDump = null |
Prototype changed | 2.10.0 | $object = null, $objectDump = null |
Method added | 2.0.0 | $object = null |
bool $dst = false
string
Returns abbreviated name of the current timezone according to DST setting.
Prototype changed | 3.0.0 | bool $dst = false |
Method added | 2.0.0 | $dst = false |
bool $dst = false
string
@alias getAbbreviatedName
Returns abbreviated name of the current timezone according to DST setting.
Prototype changed | 3.0.0 | bool $dst = false |
Method added | 2.0.0 | $dst = false |
?DateTimeInterface $date = null
string
Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
Method added | 2.10.0 | ?DateTimeInterface $date = null |
?DateTimeInterface $date = null
CarbonTimeZone
Returns a new CarbonTimeZone object using the offset string instead of region string.
Method added | 2.10.0 | ?DateTimeInterface $date = null |
?DateTimeInterface $date = null, int $isDST = 1
string
Returns the first region string (such as "America/Toronto") that matches the current timezone or false if no match is found.
Prototype changed | 3.0.0 | ?DateTimeInterface $date = null, int $isDST = 1 |
Method added | 2.10.0 | ?DateTimeInterface $date = null, $isDst = 1 |
?DateTimeInterface $date = null
CarbonTimeZone
Returns a new CarbonTimeZone object using the region string instead of offset string.
Method added | 2.10.0 | ?DateTimeInterface $date = null |
string
Cast to string (get timezone name).
Method added | 2.10.0 | no arguments |
int
Return the type number:
Type 1; A UTC offset, such as -0300
Type 2; A timezone abbreviation, such as GMT
Type 3: A timezone identifier, such as Europe/London
Method added | 2.61.0 | no arguments |
$object = null
false|CarbonTimeZone
Create a CarbonTimeZone from mixed input.
Method added | 2.0.0 | $object = null |
float $hourOffset
false|CarbonTimeZone
Create a CarbonTimeZone from int/float hour offset.
Method added | 2.33.0 | float $hourOffset |
float $minuteOffset
false|CarbonTimeZone
Create a CarbonTimeZone from int/float minute offset.
Method added | 2.33.0 | float $minuteOffset |
float $minutes
string
Convert a total minutes offset into a standardized timezone offset string.
Method added | 2.33.0 | float $minutes |
array
CarbonTimeZone
WrapperClock
Method added | 3.0.0 | no arguments |
?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null
string
Prototype changed | 2.55.0 | ?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null |
Method added | 1.25.0 | $id, array $parameters = [], $domain = null, $locale = null |
Symfony\Component\Translation\MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages'
mixed
@param mixed $translator
Method added | 2.55.0 | Symfony\Component\Translation\MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages' |
?string $locale = null
Translator
Return a singleton instance of Translator.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 1.25.0 | $locale = null |
$locale, ?Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false
Create a new Carbon instance.
Please see the testing aids section (specifically static::setTestNow())
for more on the possibility of this constructor returning a test instance.
Method added | 1.25.0 | $locale, ?Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false |
array
Returns the list of directories translation files are searched in.
Method added | 2.0.0 | no arguments |
array $directories
Translator
Set list of directories translation files are searched in.
Method added | 2.0.0 | array $directories |
string $directory
Translator
Add a directory to the list translation files are searched in.
Method added | 2.0.0 | string $directory |
string $directory
Translator
Remove a directory from the list translation files are searched in.
Method added | 2.0.0 | string $directory |
?string $locale = null
bool
Reset messages of a locale (all locale if no locale passed). Remove custom messages and reload initial messages from matching file in Lang directory.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 1.25.0 | $locale = null |
string $prefix = ''
array
Returns the list of files matching a given locale prefix (or all if empty).
Prototype changed | 3.0.0 | string $prefix = '' |
Method added | 2.0.0 | $prefix = '' |
string $prefix = ''
array
Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)
Prototype changed | 3.0.0 | string $prefix = '' |
Method added | 2.0.0 | $prefix = '' |
string $locale, array $messages
Translator
Set messages of a locale and take file first if present.
Prototype changed | 3.0.0 | string $locale, array $messages |
Method added | 1.25.0 | $locale, $messages |
array $messages
Translator
Set messages of the current locale and take file first if present.
Prototype changed | 3.0.0 | array $messages |
Method added | 2.9.0 | $messages |
?string $locale = null
array
Get messages of a locale, if none given, return all the languages.
Prototype changed | 3.0.0 | ?string $locale = null |
Method added | 1.25.0 | $locale = null |
$locale
Set the current translator locale and indicate if the source locale file exists
Method added | 1.25.0 | $locale |
array
Show locale on \Carbon\Doc\Generate\var_dump().
Method added | 2.17.0 | no arguments |
array
Returns the values to dump on serialize() called on.
Only used by PHP >= 7.4.
Method added | 3.3.1 | no arguments |
array $data
Set locale if specified on unserialize() called.
Only used by PHP >= 7.4.
Method added | 3.3.1 | array $data |
See Symfony\Component\Translation\Translator::setConfigCacheFactory
See Symfony\Component\Translation\Translator::addLoader
See Symfony\Component\Translation\Translator::addResource
string
See Symfony\Component\Translation\Translator::getLocale
See Symfony\Component\Translation\Translator::setFallbackLocales
array
See Symfony\Component\Translation\Translator::getFallbackLocales
Symfony\Component\Translation\MessageCatalogueInterface
See Symfony\Component\Translation\Translator::getCatalogue
array
See Symfony\Component\Translation\Translator::getCatalogues
string $id
Create a new Carbon instance.
Please see the testing aids section (specifically static::setTestNow())
for more on the possibility of this constructor returning a test instance.
Method added | 2.10.1 | string $id |
array
Get the list of the known languages.
Method added | 2.10.1 | no arguments |
array
Get the list of the known regions.
⚠ ISO 3166-2 short name provided with no warranty, should not
be used for any purpose to show official state names.
Method added | 2.10.1 | no arguments |
array
Get both isoName and nativeName as an array.
Method added | 2.10.1 | no arguments |
string
Returns the original locale ID.
Method added | 2.10.1 | no arguments |
string
Returns the code of the locale "en"/"fr".
Method added | 2.10.1 | no arguments |
string
Returns the variant code such as cyrl/latn.
Method added | 2.10.1 | no arguments |
string
Returns the variant such as Cyrillic/Latin.
Method added | 2.10.1 | no arguments |
string
Returns the region part of the locale.
Method added | 2.10.1 | no arguments |
string
Returns the region name for the current language.
⚠ ISO 3166-2 short name provided with no warranty, should not
be used for any purpose to show official state names.
Method added | 2.10.1 | no arguments |
string
Returns the long ISO language name.
Method added | 2.10.1 | no arguments |
string $isoName
Language
Set the ISO language name.
Method added | 2.10.1 | string $isoName |
string
Return the full name of the language in this language.
Method added | 2.10.1 | no arguments |
string $nativeName
Language
Set the name of the language in this language.
Method added | 2.10.1 | string $nativeName |
string
Returns the short ISO language name.
Method added | 2.10.1 | no arguments |
string
Get the short name of the language in this language.
Method added | 2.10.1 | no arguments |
string
Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable.
Method added | 2.10.1 | no arguments |
string
Get a string with short native name, region in parentheses if applicable, variant in parentheses if applicable.
Method added | 2.10.1 | no arguments |
string
Get a string with long ISO name, region in parentheses if applicable, variant in parentheses if applicable.
Method added | 2.10.1 | no arguments |
string
Get a string with long native name, region in parentheses if applicable, variant in parentheses if applicable.
Method added | 2.10.1 | no arguments |
string
Returns the original locale ID.
Method added | 2.10.1 | no arguments |
string
Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable.
Method added | 2.10.1 | no arguments |
bool
Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.)
Method added | 2.0.0 | no arguments |
bool
Check if the current instance has non-UTC timezone.
Method added | 2.0.0 | no arguments |
bool
Check if the current instance is a valid date.
Method added | 2.0.0 | no arguments |
bool
Check if the current instance is in a daylight saving time.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance day is sunday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is monday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is tuesday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is wednesday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is thursday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is friday.
Method added | 1.20.0 | no arguments |
bool
Checks if the instance day is saturday.
Method added | 1.20.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Prototype changed | 2.0.0 | \DateTimeInterface $date = null |
Prototype changed | 1.23.0 | $date = null |
Method added | 1.22.0 | ?Carbon\Carbon $date = null |
bool
Checks if the instance is in the same year as the current moment.
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same year as the current moment next year.
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same year as the current moment last year.
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same month as the current moment.
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.29.2 | $ofSameYear = null |
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same month as the current moment next month.
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same month as the current moment last month.
Method added | 1.22.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same week as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same week as the current moment next week.
Method added | 1.22.0 | no arguments |
bool
Checks if the instance is in the same week as the current moment last week.
Method added | 1.22.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Prototype changed | 2.0.0 | \DateTimeInterface $date = null |
Prototype changed | 1.27.0 | $date = null |
Prototype changed | 1.23.0 | $date |
Method added | 1.11.0 | Carbon\Carbon $date |
bool
Checks if the instance is in the same day as the current moment.
Method added | 1.27.0 | no arguments |
bool
Checks if the instance is in the same day as the current moment next day.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same day as the current moment last day.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Prototype changed | 2.0.0 | \DateTimeInterface $date = null |
Method added | 1.27.0 | $date = null |
bool
Checks if the instance is in the same hour as the current moment.
Method added | 1.27.0 | no arguments |
bool
Checks if the instance is in the same hour as the current moment next hour.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same hour as the current moment last hour.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Prototype changed | 2.0.0 | \DateTimeInterface $date = null |
Method added | 1.27.0 | $date = null |
bool
Checks if the instance is in the same minute as the current moment.
Method added | 1.27.0 | no arguments |
bool
Checks if the instance is in the same minute as the current moment next minute.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same minute as the current moment last minute.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Prototype changed | 2.0.0 | \DateTimeInterface $date = null |
Method added | 1.27.0 | $date = null |
bool
Checks if the instance is in the same second as the current moment.
Method added | 1.27.0 | no arguments |
bool
Checks if the instance is in the same second as the current moment next second.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same second as the current moment last second.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same millisecond as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Method added | 3.0.0 | Carbon|DateTimeInterface|string|null $date = null |
bool
Checks if the instance is in the same millisecond as the current moment.
Method added | 3.0.0 | no arguments |
bool
Checks if the instance is in the same millisecond as the current moment next millisecond.
Method added | 3.0.0 | no arguments |
bool
Checks if the instance is in the same millisecond as the current moment last millisecond.
Method added | 3.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same millisecond as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Method added | 3.0.0 | Carbon|DateTimeInterface|string|null $date = null |
bool
Checks if the instance is in the same millisecond as the current moment.
Method added | 3.0.0 | no arguments |
bool
Checks if the instance is in the same millisecond as the current moment next millisecond.
Method added | 3.0.0 | no arguments |
bool
Checks if the instance is in the same millisecond as the current moment last millisecond.
Method added | 3.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same microsecond as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same microsecond as the current moment next microsecond.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same microsecond as the current moment last microsecond.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same microsecond as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same microsecond as the current moment next microsecond.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same microsecond as the current moment last microsecond.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same decade as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same decade as the current moment next decade.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same decade as the current moment last decade.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same century as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same century as the current moment next century.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same century as the current moment last century.
Method added | 2.0.0 | no arguments |
DateTimeInterface|string $date
bool
Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone).
Prototype changed | 3.2.0 | DateTimeInterface|string $date |
Prototype changed | 2.34.2 | Carbon|DateTimeInterface|string|null $date = null |
Prototype changed | 2.24.0 | \Carbon\Carbon|\DateTimeInterface|string|null $date = null |
Method added | 2.0.0 | \DateTimeInterface $date = null |
bool
Checks if the instance is in the same millennium as the current moment.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same millennium as the current moment next millennium.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same millennium as the current moment last millennium.
Method added | 2.0.0 | no arguments |
bool
Checks if the instance is in the same quarter as the current moment.
Method added | 1.26.4 | no arguments |
bool
Checks if the instance is in the same quarter as the current moment next quarter.
Method added | 1.26.4 | no arguments |
bool
Checks if the instance is in the same quarter as the current moment last quarter.
Method added | 1.26.4 | no arguments |
int $value
$this
Set current instance year to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance year to the given value.
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
int $value
$this
Set current instance year to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance year to the given value.
Method added | 2.0.0 | int $value |
Month|int $value
$this
Set current instance month to the given value.
Prototype changed | 3.0.0 | Month|int $value |
Method added | 2.0.0 | int $value |
Month|int $value
$this
Set current instance month to the given value.
Prototype changed | 3.0.0 | Month|int $value |
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
Month|int $value
$this
Set current instance month to the given value.
Prototype changed | 3.0.0 | Month|int $value |
Method added | 2.0.0 | int $value |
Month|int $value
$this
Set current instance month to the given value.
Prototype changed | 3.0.0 | Month|int $value |
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance day to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance day to the given value.
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
int $value
$this
Set current instance day to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance day to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance hour to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance hour to the given value.
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
int $value
$this
Set current instance hour to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance hour to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance minute to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance minute to the given value.
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
int $value
$this
Set current instance minute to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance minute to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance second to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance second to the given value.
Prototype changed | 2.0.0 | int $value |
Method added | 1.0.0 | $value |
int $value
$this
Set current instance second to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance second to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance millisecond to the given value.
Method added | 2.7.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int $value
$this
Set current instance microsecond to the given value.
Method added | 2.0.0 | int $value |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one year to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one year to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.24.0 | $value |
$this
Add one year to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.24.0 | $value = 1 |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.24.0 | $value |
$this
Sub one year to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.24.0 | $value = 1 |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.24.0 | $value |
$this
Add one year to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.24.0 | $value = 1 |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.24.0 | $value |
$this
Sub one year to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.24.0 | $value = 1 |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one month to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one month to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Add one month to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Sub one month to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.14.0 | $value |
$this
Add one month to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.14.0 | no arguments |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.14.0 | $value |
$this
Sub one month to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.14.0 | no arguments |
int|float $value = 1
$this
Add days (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one day to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub days (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one day to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add hours (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one hour to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub hours (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one hour to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add minutes (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one minute to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub minutes (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one minute to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add seconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one second to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub seconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one second to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add milliseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.6.0 | int $value = 1 |
$this
Add one millisecond to the instance (using date interval).
Method added | 2.6.0 | no arguments |
int|float $value = 1
$this
Sub milliseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.6.0 | int $value = 1 |
$this
Sub one millisecond to the instance (using date interval).
Method added | 2.6.0 | no arguments |
int|float $value = 1
$this
Add milliseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.6.0 | int $value = 1 |
$this
Add one millisecond to the instance (using date interval).
Method added | 2.6.0 | no arguments |
int|float $value = 1
$this
Sub milliseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.6.0 | int $value = 1 |
$this
Sub one millisecond to the instance (using date interval).
Method added | 2.6.0 | no arguments |
int|float $value = 1
$this
Add microseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one microsecond to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub microseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one microsecond to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add microseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one microsecond to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub microseconds (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one microsecond to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one millennium to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one millennium to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one millennium to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one millennium to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one millennium to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Add one century to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Sub one century to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one century to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one century to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one century to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one decade to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one decade to the instance (using date interval).
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one decade to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one decade to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one decade to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Add one quarter to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.22.0 | $value |
$this
Sub one quarter to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Method added | 1.22.0 | $value = 1 |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one quarter to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one quarter to the instance (using date interval) with overflow explicitly allowed.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Add one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.
Prototype changed | 3.0.0 | int|float $value = 1 |
Method added | 2.0.0 | int $value = 1 |
$this
Sub one quarter to the instance (using date interval) with overflow explicitly forbidden.
Method added | 2.0.0 | no arguments |
int|float $value = 1
$this
Add weeks (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one week to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub weeks (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one week to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add weekdays (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Add one weekday to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Sub weekdays (the $value count passed in) to the instance (using date interval).
Prototype changed | 3.0.0 | int|float $value = 1 |
Prototype changed | 2.0.0 | int $value = 1 |
Method added | 1.0.0 | $value |
$this
Sub one weekday to the instance (using date interval).
Prototype changed | 2.0.0 | no arguments |
Prototype changed | 1.18.0 | $value = 1 |
Method added | 1.0.0 | no arguments |
int|float $value = 1
$this
Add microseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one microsecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub microseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one microsecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of microseconds.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add microseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one microsecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub microseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one microsecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of microseconds.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add milliseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one millisecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub milliseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one millisecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of milliseconds.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add milliseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one millisecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub milliseconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one millisecond to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of milliseconds.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add seconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one second to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub seconds (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one second to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of seconds.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add minutes (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one minute to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub minutes (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one minute to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of minutes.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add hours (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one hour to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub hours (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one hour to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of hours.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add days (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one day to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub days (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one day to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of days.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add weeks (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one week to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub weeks (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one week to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of weeks.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add months (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one month to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub months (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one month to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of months.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add quarters (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one quarter to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub quarters (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one quarter to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of quarters.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add years (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one year to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub years (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one year to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of years.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add decades (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one decade to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub decades (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one decade to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of decades.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add centuries (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one century to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub centuries (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one century to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of centuries.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
int|float $value = 1
$this
Add millennia (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Add one millennium to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
int|float $value = 1
$this
Sub millennia (the $value count passed in) to the instance (using timestamp).
Method added | 3.2.0 | int|float $value = 1 |
$this
Sub one millennium to the instance (using timestamp).
Method added | 3.2.0 | no arguments |
$endDate = null, int|float $factor = 1
CarbonPeriod
Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given.
Prototype changed | 3.0.0 | $endDate = null, int|float $factor = 1 |
Method added | 2.20.0 | $endDate = null, int $factor = 1 |
DateTimeInterface|string|null $date, bool $absolute = false
float
Convert current and given date in UTC timezone and return a floating number of millennia.
Method added | 3.2.0 | DateTimeInterface|string|null $date, bool $absolute = false |
float $precision = 1, string $function = "round"
$this
Round the current instance year with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance year with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance year with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance year with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance year with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance year with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance month with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance month with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance month with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance month with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance month with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance month with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance day with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance day with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance day with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance day with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance day with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance day with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance hour with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance hour with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance hour with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance hour with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance hour with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance hour with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance minute with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance minute with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance minute with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance minute with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance minute with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance minute with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance second with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance second with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance second with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance second with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance second with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance second with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance millennium with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance millennium with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance millennium with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance millennium with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance millennium with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance millennium with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance century with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance century with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance century with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance century with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance century with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance century with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance decade with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance decade with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance decade with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance decade with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance decade with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance decade with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance quarter with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance quarter with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance quarter with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance quarter with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance quarter with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance quarter with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance millisecond with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance millisecond with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance millisecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance millisecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance millisecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance millisecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1, string $function = "round"
$this
Round the current instance microsecond with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1, string $function = "round"
$this
Round the current instance microsecond with given precision using the given function.
Method added | 2.0.0 | float $precision = 1, string $function = "round" |
float $precision = 1
$this
Truncate the current instance microsecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Truncate the current instance microsecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance microsecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
float $precision = 1
$this
Ceil the current instance microsecond with given precision.
Method added | 2.0.0 | float $precision = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
DateTimeInterface $other = null, int $parts = 1
string
Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
Prototype changed | 2.34.2 | DateTimeInterface $other = null, int $parts = 1 |
Method added | 2.0.0 | \DateTimeInterface $other = null, int $parts = 1 |
int
Return the number of centuries contained in the current millennium
Method added | 3.0.0 | no arguments |
?int $century = null
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
Method added | 3.0.0 | ?int $century = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
?int $day = null
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
Method added | 3.0.0 | ?int $day = null |
int
Return the number of days contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of days contained in the current year
Method added | 3.0.0 | no arguments |
?int $decade = null
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
Method added | 3.0.0 | ?int $decade = null |
?int $decade = null
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
Method added | 3.0.0 | ?int $decade = null |
int
Return the number of decades contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of decades contained in the current millennium
Method added | 3.0.0 | no arguments |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
?int $hour = null
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
Method added | 3.0.0 | ?int $hour = null |
int
Return the number of hours contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current day
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of hours contained in the current year
Method added | 3.0.0 | no arguments |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
?int $microsecond = null
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
Method added | 3.0.0 | ?int $microsecond = null |
int
Return the number of microseconds contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current day
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current hour
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current millisecond
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current minute
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current second
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of microseconds contained in the current year
Method added | 3.0.0 | no arguments |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
?int $millisecond = null
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
Method added | 3.0.0 | ?int $millisecond = null |
int
Return the number of milliseconds contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current day
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current hour
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current minute
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current second
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of milliseconds contained in the current year
Method added | 3.0.0 | no arguments |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
?int $minute = null
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
Method added | 3.0.0 | ?int $minute = null |
int
Return the number of minutes contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current day
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current hour
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of minutes contained in the current year
Method added | 3.0.0 | no arguments |
?int $month = null
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
Method added | 3.0.0 | ?int $month = null |
?int $month = null
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
Method added | 3.0.0 | ?int $month = null |
?int $month = null
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
Method added | 3.0.0 | ?int $month = null |
?int $month = null
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
Method added | 3.0.0 | ?int $month = null |
?int $month = null
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
Method added | 3.0.0 | ?int $month = null |
int
Return the number of months contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of months contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of months contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of months contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of months contained in the current year
Method added | 3.0.0 | no arguments |
?int $quarter = null
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
Method added | 3.0.0 | ?int $quarter = null |
?int $quarter = null
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
Method added | 3.0.0 | ?int $quarter = null |
?int $quarter = null
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
Method added | 3.0.0 | ?int $quarter = null |
?int $quarter = null
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
Method added | 3.0.0 | ?int $quarter = null |
int
Return the number of quarters contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of quarters contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of quarters contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of quarters contained in the current year
Method added | 3.0.0 | no arguments |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
?int $second = null
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
Method added | 3.0.0 | ?int $second = null |
int
Return the number of seconds contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current day
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current hour
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current minute
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current quarter
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current week
Method added | 3.0.0 | no arguments |
int
Return the number of seconds contained in the current year
Method added | 3.0.0 | no arguments |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
?int $week = null
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
Method added | 3.0.0 | ?int $week = null |
int
Return the number of weeks contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of weeks contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of weeks contained in the current millennium
Method added | 3.0.0 | no arguments |
int
Return the number of weeks contained in the current month
Method added | 3.0.0 | no arguments |
int
Return the number of weeks contained in the current quarter
Method added | 3.0.0 | no arguments |
?int $year = null
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
Method added | 3.0.0 | ?int $year = null |
?int $year = null
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
Method added | 3.0.0 | ?int $year = null |
?int $year = null
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
Method added | 3.0.0 | ?int $year = null |
int
Return the number of years contained in the current century
Method added | 3.0.0 | no arguments |
int
Return the number of years contained in the current decade
Method added | 3.0.0 | no arguments |
int
Return the number of years contained in the current millennium
Method added | 3.0.0 | no arguments |