FileAccess Orion

Difference

Trait Difference.

Depends on the following methods:

Table of Contents

ago()  : string
Get the difference in a human readable format in the current locale from an other instance given to now
calendar()  : string
Returns either the close date "Friday 15h30", or a calendar date "10/09/2017" is farthest than 7 days from now.
copy()  : void
diff()  : DateInterval
diff()  : DateInterval
Get the difference as a DateInterval instance.
diffAsCarbonInterval()  : CarbonInterval
Get the difference as a CarbonInterval instance.
diffFiltered()  : int
Get the difference by the given interval using a filter closure.
diffForHumans()  : 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).
diffInDays()  : int
Get the difference in days rounded down.
diffInDaysFiltered()  : int
Get the difference in days using a filter closure rounded down.
diffInHours()  : int
Get the difference in hours rounded down.
diffInHoursFiltered()  : int
Get the difference in hours using a filter closure rounded down.
diffInMicroseconds()  : int
Get the difference in microseconds.
diffInMilliseconds()  : int
Get the difference in milliseconds rounded down.
diffInMinutes()  : int
Get the difference in minutes rounded down.
diffInMonths()  : int
Get the difference in months rounded down.
diffInQuarters()  : int
Get the difference in quarters rounded down.
diffInRealHours()  : int
Get the difference in hours rounded down using timestamps.
diffInRealMicroseconds()  : int
Get the difference in microseconds using timestamps.
diffInRealMilliseconds()  : int
Get the difference in milliseconds rounded down using timestamps.
diffInRealMinutes()  : int
Get the difference in minutes rounded down using timestamps.
diffInRealSeconds()  : int
Get the difference in seconds using timestamps.
diffInSeconds()  : int
Get the difference in seconds rounded down.
diffInWeekdays()  : int
Get the difference in weekdays rounded down.
diffInWeekendDays()  : int
Get the difference in weekend days using a filter rounded down.
diffInWeeks()  : int
Get the difference in weeks rounded down.
diffInYears()  : int
Get the difference in years
floatDiffInDays()  : float
Get the difference in days as float (microsecond-precision).
floatDiffInHours()  : float
Get the difference in hours as float (microsecond-precision).
floatDiffInMinutes()  : float
Get the difference in minutes as float (microsecond-precision).
floatDiffInMonths()  : float
Get the difference in months as float (microsecond-precision).
floatDiffInRealDays()  : float
Get the difference in days as float (microsecond-precision).
floatDiffInRealHours()  : float
Get the difference in hours as float (microsecond-precision) using timestamps.
floatDiffInRealMinutes()  : float
Get the difference in minutes as float (microsecond-precision) using timestamps.
floatDiffInRealMonths()  : float
Get the difference in months as float (microsecond-precision) using timestamps.
floatDiffInRealSeconds()  : float
Get the difference in seconds as float (microsecond-precision) using timestamps.
floatDiffInRealYears()  : float
Get the difference in year as float (microsecond-precision) using timestamps.
floatDiffInSeconds()  : float
Get the difference in seconds as float (microsecond-precision).
floatDiffInYears()  : float
Get the difference in year as float (microsecond-precision).
from()  : string
fromNow()  : string
Get the difference in a human readable format in the current locale from current instance to now.
lessThan()  : bool
resolveCarbon()  : void
secondsSinceMidnight()  : int
The number of seconds since midnight.
secondsUntilEndOfDay()  : int
The number of seconds until 23:59:59.
since()  : mixed
timespan()  : 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).
to()  : 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.
toNow()  : string
Get the difference in a human readable format in the current locale from an other instance given to now
translator()  : Translator
until()  : string
fixDiffInterval()  : CarbonInterval
fixNegativeMicroseconds()  : mixed

Methods

ago()

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

public ago([int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single part)

$options : int = null

human diff options

Return values
string

calendar()

Returns either the close date "Friday 15h30", or a calendar date "10/09/2017" is farthest than 7 days from now.

public calendar([Carbon|DateTimeInterface|string|null $referenceTime = null ][, array<string|int, mixed> $formats = [] ]) : string
Parameters
$referenceTime : Carbon|DateTimeInterface|string|null = null
$formats : array<string|int, mixed> = []
Return values
string

copy()

public static copy() : void
Return values
void

diff()

public diff(DateTimeInterface $date, bool $absolute = false) : DateInterval
Parameters
$date : DateTimeInterface
$absolute = false : bool
Return values
DateInterval

diff()

Get the difference as a DateInterval instance.

public diff([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = false ]) : DateInterval

Return relative interval (negative if

Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = false

Get the absolute of the difference

Return values
DateInterval

diffAsCarbonInterval()

Get the difference as a CarbonInterval instance.

public diffAsCarbonInterval([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : CarbonInterval

Return absolute interval (always positive) unless you pass false to the second argument.

Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
CarbonInterval

diffFiltered()

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

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

An interval to traverse by

$callback : Closure
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

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

public diffForHumans([Carbon|DateTimeInterface|string|array<string|int, mixed>|null $other = null ][, int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$other : Carbon|DateTimeInterface|string|array<string|int, mixed>|null = null

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.

$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single unit)

$options : int = null

human diff options

Tags
example
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";
Return values
string

diffInDays()

Get the difference in days rounded down.

public diffInDays([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInDaysFiltered()

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

public diffInDaysFiltered(Closure $callback[, CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$callback : Closure
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInHours()

Get the difference in hours rounded down.

public diffInHours([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInHoursFiltered()

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

public diffInHoursFiltered(Closure $callback[, CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$callback : Closure
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInMicroseconds()

Get the difference in microseconds.

public diffInMicroseconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInMilliseconds()

Get the difference in milliseconds rounded down.

public diffInMilliseconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInMinutes()

Get the difference in minutes rounded down.

public diffInMinutes([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInMonths()

Get the difference in months rounded down.

public diffInMonths([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInQuarters()

Get the difference in quarters rounded down.

public diffInQuarters([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInRealHours()

Get the difference in hours rounded down using timestamps.

public diffInRealHours([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInRealMicroseconds()

Get the difference in microseconds using timestamps.

public diffInRealMicroseconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInRealMilliseconds()

Get the difference in milliseconds rounded down using timestamps.

public diffInRealMilliseconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInRealMinutes()

Get the difference in minutes rounded down using timestamps.

public diffInRealMinutes([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInRealSeconds()

Get the difference in seconds using timestamps.

public diffInRealSeconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInSeconds()

Get the difference in seconds rounded down.

public diffInSeconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInWeekdays()

Get the difference in weekdays rounded down.

public diffInWeekdays([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInWeekendDays()

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

public diffInWeekendDays([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInWeeks()

Get the difference in weeks rounded down.

public diffInWeeks([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

diffInYears()

Get the difference in years

public diffInYears([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : int
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
int

floatDiffInDays()

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

public floatDiffInDays([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInHours()

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

public floatDiffInHours([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInMinutes()

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

public floatDiffInMinutes([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInMonths()

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

public floatDiffInMonths([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealDays()

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

public floatDiffInRealDays([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealHours()

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

public floatDiffInRealHours([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealMinutes()

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

public floatDiffInRealMinutes([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealMonths()

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

public floatDiffInRealMonths([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealSeconds()

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

public floatDiffInRealSeconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInRealYears()

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

public floatDiffInRealYears([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInSeconds()

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

public floatDiffInSeconds([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

floatDiffInYears()

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

public floatDiffInYears([CarbonInterface|DateTimeInterface|string|null $date = null ][, bool $absolute = true ]) : float
Parameters
$date : CarbonInterface|DateTimeInterface|string|null = null
$absolute : bool = true

Get the absolute of the difference

Return values
float

from()

public from([Carbon|DateTimeInterface|string|array<string|int, mixed>|null $other = null ][, int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$other : Carbon|DateTimeInterface|string|array<string|int, mixed>|null = null

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.

$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single unit)

$options : int = null

human diff options

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

Return values
string

fromNow()

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

public fromNow([int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single unit)

$options : int = null

human diff options

Return values
string

lessThan()

public lessThan(mixed $date) : bool
Parameters
$date : mixed
Return values
bool

resolveCarbon()

public static resolveCarbon(mixed $date) : void
Parameters
$date : mixed
Return values
void

secondsSinceMidnight()

The number of seconds since midnight.

public secondsSinceMidnight() : int
Return values
int

secondsUntilEndOfDay()

The number of seconds until 23:59:59.

public secondsUntilEndOfDay() : int
Return values
int

since()

public since([mixed $other = null ][, mixed $syntax = null ][, mixed $short = false ][, mixed $parts = 1 ][, mixed $options = null ]) : mixed
Parameters
$other : mixed = null
$syntax : mixed = null
$short : mixed = false
$parts : mixed = 1
$options : mixed = null
Tags
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).

Return values
mixed

timespan()

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

public timespan([mixed $other = null ][, mixed $timezone = null ]) : string
Parameters
$other : mixed = null
$timezone : mixed = null
Return values
string

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.

public to([Carbon|DateTimeInterface|string|array<string|int, mixed>|null $other = null ][, int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string

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
$other : Carbon|DateTimeInterface|string|array<string|int, mixed>|null = null

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.

$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single unit)

$options : int = null

human diff options

Return values
string

toNow()

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

public toNow([int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single part)

$options : int = null

human diff options

Return values
string

until()

public until([Carbon|DateTimeInterface|string|array<string|int, mixed>|null $other = null ][, int|array<string|int, mixed> $syntax = null ][, bool $short = false ][, int $parts = 1 ][, int $options = null ]) : string
Parameters
$other : Carbon|DateTimeInterface|string|array<string|int, mixed>|null = null

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.

$syntax : int|array<string|int, mixed> = null

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
$short : bool = false

displays short format of time units

$parts : int = 1

maximum number of parts to display (default value: 1: single unit)

$options : int = null

human diff options

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

Return values
string

Search results