class Carbon extends Carbon (View source)

Traits

Methods

$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

never
dd(mixed ...$args)

Dump the given arguments and terminate execution.

from  Dumpable
$this
dump(mixed ...$args)

Dump the given arguments.

from  Dumpable
static void
setTestNow(mixed $testNow = null)

{@inheritdoc}

static Carbon
createFromId(Ulid|string $id)

Create a Carbon instance from a given ordered UUID or ULID.

plus(int $years = 0, int $months = 0, int $weeks = 0, int $days = 0, int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0)

Get the current date / time plus a given amount of time.

minus(int $years = 0, int $months = 0, int $weeks = 0, int $days = 0, int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0)

Get the current date / time minus a given amount of time.

Details

$this|TWhenReturnType when($value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

$value
callable|null $callback
callable|null $default

Return Value

$this|TWhenReturnType

$this|TUnlessReturnType unless($value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

$value
callable|null $callback
callable|null $default

Return Value

$this|TUnlessReturnType

never dd(mixed ...$args)

Dump the given arguments and terminate execution.

Parameters

mixed ...$args

Return Value

never

$this dump(mixed ...$args)

Dump the given arguments.

Parameters

mixed ...$args

Return Value

$this

static void setTestNow(mixed $testNow = null)

{@inheritdoc}

Parameters

mixed $testNow

Return Value

void

static Carbon createFromId(Ulid|string $id)

Create a Carbon instance from a given ordered UUID or ULID.

Parameters

Ulid|string $id

Return Value

Carbon

Carbon plus(int $years = 0, int $months = 0, int $weeks = 0, int $days = 0, int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0)

Get the current date / time plus a given amount of time.

Parameters

int $years
int $months
int $weeks
int $days
int $hours
int $minutes
int $seconds
int $microseconds

Return Value

Carbon

Carbon minus(int $years = 0, int $months = 0, int $weeks = 0, int $days = 0, int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0)

Get the current date / time minus a given amount of time.

Parameters

int $years
int $months
int $weeks
int $days
int $hours
int $minutes
int $seconds
int $microseconds

Return Value

Carbon