trait Difference

Trait Difference.

Depends on the following methods:

Methods

static 
fixDiffInterval(DateInterval$diff,bool$absolute)

No description

diff($date =null,$absolute =false)

No description

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

Get the difference as a CarbonInterval instance.

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

Get the difference in years

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

Get the difference in quarters rounded down.

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

Get the difference in months rounded down.

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

Get the difference in weeks rounded down.

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

Get the difference in days rounded down.

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

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

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

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

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

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

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

Get the difference in weekdays rounded down.

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

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

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

Get the difference in hours rounded down.

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

Get the difference in hours rounded down using timestamps.

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

Get the difference in minutes rounded down.

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

Get the difference in minutes rounded down using timestamps.

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

Get the difference in seconds rounded down.

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

Get the difference in microseconds.

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

Get the difference in milliseconds rounded down.

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

Get the difference in seconds using timestamps.

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

Get the difference in microseconds using timestamps.

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

Get the difference in milliseconds rounded down using timestamps.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

int
secondsSinceMidnight()

The number of seconds since midnight.

int
secondsUntilEndOfDay()

The number of seconds until 23:59:59.

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

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

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

No description

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

No description

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

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

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

No description

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

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

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

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

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

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

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

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

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

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

bool
lessThan($date)

No description

static
copy()

No description

static
resolveCarbon($date =null)

No description

Details

at line42
staticprotected fixNegativeMicroseconds(CarbonInterval$diff)

Parameters

CarbonInterval $diff

at line86
staticprotectedCarbonInterval fixDiffInterval(DateInterval$diff,bool$absolute)

Parameters

DateInterval $diff
bool $absolute

Return Value

CarbonInterval

at line124
diff($date =null,$absolute =false)

Parameters

$date
$absolute

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

Get the difference as a CarbonInterval instance.

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

Parameters

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

Return Value

CarbonInterval

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

Get the difference in years

Parameters

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

Return Value

int

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

Get the difference in quarters rounded down.

Parameters

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

Return Value

int

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

Get the difference in months rounded down.

Parameters

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

Return Value

int

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

Get the difference in weeks rounded down.

Parameters

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

Return Value

int

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

Get the difference in days rounded down.

Parameters

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

Return Value

int

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

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

Parameters

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

Return Value

int

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

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

Parameters

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

Return Value

int

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

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

Parameters

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

Return Value

int

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

Get the difference in weekdays rounded down.

Parameters

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

Return Value

int

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

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

Parameters

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

Return Value

int

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

Get the difference in hours rounded down.

Parameters

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

Return Value

int

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

Get the difference in hours rounded down using timestamps.

Parameters

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

Return Value

int

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

Get the difference in minutes rounded down.

Parameters

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

Return Value

int

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

Get the difference in minutes rounded down using timestamps.

Parameters

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

Return Value

int

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

Get the difference in seconds rounded down.

Parameters

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

Return Value

int

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

Get the difference in microseconds.

Parameters

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

Return Value

int

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

Get the difference in milliseconds rounded down.

Parameters

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

Return Value

int

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

Get the difference in seconds using timestamps.

Parameters

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

Return Value

int

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

Get the difference in microseconds using timestamps.

Parameters

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

Return Value

int

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

Get the difference in milliseconds rounded down using timestamps.

Parameters

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

Return Value

int

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

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

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

Parameters

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

Return Value

float

at line753
int secondsSinceMidnight()

The number of seconds since midnight.

Return Value

int

at line763
int secondsUntilEndOfDay()

The number of seconds until 23:59:59.

Return Value

int

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

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

Parameters

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

Return Value

string

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

Parameters

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

Return Value

string

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

Parameters

$other
$syntax
$short
$parts
$options

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

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

When comparing a value in the past to default now: 1 hour from now 5 months from now

When comparing a value in the future to default now: 1 hour ago 5 months ago

When comparing a value in the past to another value: 1 hour after 5 months after

When comparing a value in the future to another value: 1 hour before 5 months before

Parameters

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

Return Value

string

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

Parameters

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

Return Value

string

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

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

Parameters

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

Return Value

string

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

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

Parameters

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

Return Value

string

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

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

Parameters

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

Return Value

string

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

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

Parameters

$other
$timezone

Return Value

string

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

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

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

Parameters

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

Return Value

string

at line35
bool lessThan($date)

Parameters

$date

Return Value

bool

at line35
static copy()

Return Value

static

at line35
static resolveCarbon($date =null)

Parameters

$date

Return Value

static