Menu

## FactoryImmutable extends Factory
in package
implements ClockInterface

FactoryImmutable.php : 130

A factory to generate CarbonImmutable instances with common settings.

<autodoc generated by `composer phpdoc`>

### Table of Contents

#### Interfaces

ClockInterface

#### Properties

$className : string
$regexFormatModifiers : array<string|int, mixed>
  Format modifiers (such as available in createFromFormat) regex patterns.
$regexFormats : array<string, string>
  Format regex patterns.
$settings : array<string|int, mixed>
$testDefaultTimezone : string|null
  The timezone to restore to when clearing the time mock.
$testNow : Closure|CarbonInterface|null
  A test Carbon instance to be returned when now instances are created.
$translator : TranslatorInterface
  Default translator.
$useTimezoneFromTestNow : bool
  Is true when test-now is generated by a closure and timezone should be taken on the fly from it.
$weekendDays : array<string|int, mixed>
  Days of weekend.
$currentClock : WrapperClock|null
$defaultInstance : self|null

#### Methods

__call() : mixed
__construct() : mixed
canBeCreatedFromFormat() : bool
canBeCreatedFromFormat() : bool
className() : self|string
createFromDate() : CarbonImmutable
createFromDate() : Carbon
createFromTime() : CarbonImmutable
createFromTime() : Carbon
createFromTimestamp() : CarbonImmutable
createFromTimestamp() : Carbon
createFromTimestampMs() : CarbonImmutable
createFromTimestampMs() : Carbon
createFromTimestampMsUTC() : CarbonImmutable
createFromTimestampMsUTC() : Carbon
createFromTimestampUTC() : CarbonImmutable
createFromTimestampUTC() : Carbon
createFromTimeString() : CarbonImmutable
createFromTimeString() : Carbon
createMidnightDate() : CarbonImmutable
createMidnightDate() : Carbon
createStrict() : CarbonImmutable
createStrict() : Carbon
disableHumanDiffOption() : void
enableHumanDiffOption() : void
executeWithLocale() : mixed
executeWithLocale() : mixed
fromSerialized() : CarbonImmutable
fromSerialized() : Carbon
genericMacro() : void
  Register a custom macro.
getAvailableLocales() : array<string|int, mixed>
getAvailableLocales() : array<string|int, mixed>
getAvailableLocalesInfo() : array<string|int, Language>
getAvailableLocalesInfo() : array<string|int, Language>
getClassName() : string
getDays() : array<string|int, mixed>
getDays() : array<string|int, mixed>
getFormatsToIsoReplacements() : array<string|int, mixed>
getFormatsToIsoReplacements() : array<string|int, mixed>
getHumanDiffOptions() : int
getIsoUnits() : array<string|int, mixed>
getIsoUnits() : array<string|int, mixed>
getLastErrors() : array<string|int, mixed>|false
getLastErrors() : array<string|int, mixed>|false
getLocale() : string
getLocale() : string
getMacro() : callable|null
  Get the raw callable macro registered globally for a given name.
getMidDayAt() : int
getMidDayAt() : int
getSettings() : array<string|int, mixed>
getTestNow() : Closure|CarbonInterface|null
  Get the Carbon instance (real or mock) to be returned when a "now" instance is created.
getTimeFormatByPrecision() : string
getTimeFormatByPrecision() : string
getTranslationMessageWith() : string|Closure|null
getTranslationMessageWith() : string|Closure|null
getTranslator() : TranslatorInterface
  Initialize the default translator instance if necessary.
getWeekendDays() : array<string|int, mixed>
  Get weekend days
getWeekEndsAt() : int
getWeekEndsAt() : int
getWeekStartsAt() : int
getWeekStartsAt() : int
handleTestNowClosure() : CarbonInterface|null
hasFormat() : bool
  Checks if the (date)time string is in a given format.
hasFormatWithModifiers() : bool
  Checks if the (date)time string is in a given format.
hasMacro() : bool
  Checks if macro is registered globally.
hasRelativeKeywords() : bool
hasRelativeKeywords() : bool
hasTestNow() : bool
  Determine if there is a valid test instance set. A valid test instance is anything that is not null.
instance() : CarbonImmutable
instance() : Carbon
isImmutable() : bool
isImmutable() : bool
isModifiableUnit() : bool
isModifiableUnit() : bool
isMutable() : bool
isMutable() : bool
isStrictModeEnabled() : bool
  Returns true if the strict mode is globally in use, false else.
localeHasDiffOneDayWords() : bool
localeHasDiffOneDayWords() : bool
localeHasDiffSyntax() : bool
localeHasDiffSyntax() : bool
localeHasDiffTwoDayWords() : bool
localeHasDiffTwoDayWords() : bool
localeHasPeriodSyntax() : bool
localeHasPeriodSyntax() : bool
localeHasShortUnits() : bool
localeHasShortUnits() : bool
macro() : void
  Register a custom macro.
mergeSettings() : self
mixin() : void
mixin() : void
now() : Carbon
now() : CarbonImmutable
  Get a Carbon instance for the current date and time.
parse() : CarbonImmutable
parse() : Carbon
parseFromLocale() : CarbonImmutable
parseFromLocale() : Carbon
pluralUnit() : string
pluralUnit() : string
rawParse() : CarbonImmutable
rawParse() : Carbon
resetMacros() : void
  Remove all macros and generic macros.
resetMonthsOverflow() : void
  Reset the month overflow behavior.
resetToStringFormat() : void
  Reset the format used to the default when type juggling a Carbon instance to a string
resetYearsOverflow() : void
  Reset the month overflow behavior.
serializeUsing() : void
  JSON serialize all Carbon instances using the given callback.
setClassName() : self
setFallbackLocale() : void
setFallbackLocale() : void
setHumanDiffOptions() : void
setLocale() : void
setLocale() : void
setMidDayAt() : void
setMidDayAt() : void
setSettings() : self
setTestNow() : void
  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().
setTestNowAndTimezone() : void
  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().
settings() : self|array<string|int, mixed>
setToStringFormat() : void
  Set the default format used when type juggling a Carbon instance to a string.
setTranslator() : void
  Set the default translator instance to use.
setWeekendDays() : void
  Set weekend days
shouldOverflowMonths() : bool
  Get the month overflow global behavior (can be overridden in specific instances).
shouldOverflowYears() : bool
  Get the month overflow global behavior (can be overridden in specific instances).
singularUnit() : string
singularUnit() : string
sleep() : void
sleep() : void
today() : CarbonImmutable
today() : Carbon
tomorrow() : CarbonImmutable
tomorrow() : Carbon
translateTimeString() : string
translateTimeString() : string
translateWith() : string
translateWith() : string
useMonthsOverflow() : void
  Indicates if months should be calculated with overflow.
useStrictMode() : void
  Enable the strict mode (or disable with passing false).
useYearsOverflow() : void
  Indicates if years should be calculated with overflow.
withTestNow() : T
  Temporarily sets a static date to be used within the callback.
withTimeZone() : static
yesterday() : CarbonImmutable
yesterday() : Carbon
getMockedTestNow() : CarbonInterface|null
  Get the mocked date passed in setTestNow() and if it's a Closure, execute it.
matchFormatPattern() : bool
  Checks if the (date)time string is in a given format with given list of pattern replacements.
setDefaultTimezone() : void

### Properties

#### $className

FactoryImmutable.php : 132
`protected string $className = \Carbon\CarbonImmutable::class`

#### $regexFormatModifiers

Factory.php : 223

Format modifiers (such as available in createFromFormat) regex patterns.

`protected array<string|int, mixed> $regexFormatModifiers = ['*' => '.+', ' ' => '[ ]', '#' => '[;:\\/.,()-]', '?' => '([^a]|[a])', '!' => '', '|' => '', '+' => '']`

#### $regexFormats

Factory.php : 174

Format regex patterns.

`protected array<string, string> $regexFormats = [ 'd' => '(3[01]|[12][0-9]|0[1-9])', 'D' => '(Sun|Mon|Tue|Wed|Thu|Fri|Sat)', 'j' => '([123][0-9]|[1-9])', 'l' => '([a-zA-Z]{2,})', 'N' => '([1-7])', 'S' => '(st|nd|rd|th)', 'w' => '([0-6])', 'z' => '(36[0-5]|3[0-5][0-9]|[12][0-9]{2}|[1-9]?[0-9])', 'W' => '(5[012]|[1-4][0-9]|0?[1-9])', 'F' => '([a-zA-Z]{2,})', 'm' => '(1[012]|0[1-9])', 'M' => '([a-zA-Z]{3})', 'n' => '(1[012]|[1-9])', 't' => '(2[89]|3[01])', 'L' => '(0|1)', 'o' => '([1-9][0-9]{0,4})', 'Y' => '([1-9]?[0-9]{4})', 'y' => '([0-9]{2})', 'a' => '(am|pm)', 'A' => '(AM|PM)', 'B' => '([0-9]{3})', 'g' => '(1[012]|[1-9])', 'G' => '(2[0-3]|1?[0-9])', 'h' => '(1[012]|0[1-9])', 'H' => '(2[0-3]|[01][0-9])', 'i' => '([0-5][0-9])', 's' => '([0-5][0-9])', 'u' => '([0-9]{1,6})', 'v' => '([0-9]{1,3})', 'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\\/[a-zA-Z]*)', 'I' => '(0|1)', 'O' => '([+-](1[0123]|0[0-9])[0134][05])', 'P' => '([+-](1[0123]|0[0-9]):[0134][05])', 'p' => '(Z|[+-](1[0123]|0[0-9]):[0134][05])', 'T' => '([a-zA-Z]{1,5})', 'Z' => '(-?[1-5]?[0-9]{1,4})', 'U' => '([0-9]*)', // The formats below are combinations of the above formats. 'c' => '(([1-9]?[0-9]{4})-(1[012]|0[1-9])-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[+-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP 'r' => '(([a-zA-Z]{3}), ([123][0-9]|0[1-9]) ([a-zA-Z]{3}) ([1-9]?[0-9]{4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [+-](1[012]|0[0-9])([0134][05]))', ]`

#### $settings

Factory.php : 139
`protected array<string|int, mixed> $settings = []`

#### $testDefaultTimezone

Factory.php : 149

The timezone to restore to when clearing the time mock.

`protected string|null $testDefaultTimezone = null`

#### $testNow

Factory.php : 144

A test Carbon instance to be returned when now instances are created.

`protected Closure|CarbonInterface|null $testNow = null`

#### $translator

Factory.php : 159

Default translator.

`protected TranslatorInterface $translator`

#### $useTimezoneFromTestNow

Factory.php : 154

Is true when test-now is generated by a closure and timezone should be taken on the fly from it.

`protected bool $useTimezoneFromTestNow = false`

#### $weekendDays

Factory.php : 164

Days of weekend.

`protected array<string|int, mixed> $weekendDays = [\Carbon\CarbonInterface::SATURDAY, \Carbon\CarbonInterface::SUNDAY]`

#### $currentClock

FactoryImmutable.php : 136
`private static WrapperClock|null $currentClock = null`

#### $defaultInstance

FactoryImmutable.php : 134
`private static self|null $defaultInstance = null`

### Methods

#### __call()

Factory.php : 721
`public __call(string $name, array<string|int, mixed> $arguments) : mixed`

##### Parameters

$name : string
$arguments : array<string|int, mixed>

#### __construct()

Factory.php : 233
`public __construct([array<string|int, mixed> $settings = [] ][, string|null $className = null ]) : mixed`

##### Parameters

$settings : array<string|int, mixed> = []
$className : string|null = null

#### canBeCreatedFromFormat()

FactoryImmutable.php : 0
`public canBeCreatedFromFormat(string|null $date, string $format) : bool`

Checks if the (date)time string is in a given format and valid to create a new instance.

##### Parameters

$date : string|null
$format : string

##### Return values

bool

#### canBeCreatedFromFormat()

Factory.php : 0
`public canBeCreatedFromFormat(string|null $date, string $format) : bool`

Checks if the (date)time string is in a given format and valid to create a new instance.

##### Parameters

$date : string|null
$format : string

##### Return values

bool

#### className()

Factory.php : 254
`public className([string|null $className = null ]) : self|string`

##### Parameters

$className : string|null = null

##### Return values

self|string

#### createFromDate()

FactoryImmutable.php : 0
`public createFromDate(mixed $year, mixed $month, mixed $day, mixed $timezone) : CarbonImmutable`

Create a Carbon instance from just a date. The time portion is set to now.

##### Parameters

$year : mixed
$month : mixed
$day : mixed
$timezone : mixed

##### Return values

CarbonImmutable

#### createFromDate()

Factory.php : 0
`public createFromDate(mixed $year, mixed $month, mixed $day, mixed $timezone) : Carbon`

Create a Carbon instance from just a date. The time portion is set to now.

##### Parameters

$year : mixed
$month : mixed
$day : mixed
$timezone : mixed

##### Return values

Carbon

#### createFromTime()

FactoryImmutable.php : 0
`public createFromTime(mixed $hour, mixed $minute, mixed $second, mixed $timezone) : CarbonImmutable`

Create a Carbon instance from just a time. The date portion is set to today.

##### Parameters

$hour : mixed
$minute : mixed
$second : mixed
$timezone : mixed

##### Return values

CarbonImmutable

#### createFromTime()

Factory.php : 0
`public createFromTime(mixed $hour, mixed $minute, mixed $second, mixed $timezone) : Carbon`

Create a Carbon instance from just a time. The date portion is set to today.

##### Parameters

$hour : mixed
$minute : mixed
$second : mixed
$timezone : mixed

##### Return values

Carbon

#### createFromTimestamp()

FactoryImmutable.php : 0
`public createFromTimestamp(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

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.

##### Parameters

$timestamp : string|int|float
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### createFromTimestamp()

Factory.php : 0
`public createFromTimestamp(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.

##### Parameters

$timestamp : string|int|float
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### createFromTimestampMs()

FactoryImmutable.php : 0
`public createFromTimestampMs(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

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.

##### Parameters

$timestamp : string|int|float
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### createFromTimestampMs()

Factory.php : 0
`public createFromTimestampMs(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.

##### Parameters

$timestamp : string|int|float
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### createFromTimestampMsUTC()

FactoryImmutable.php : 0
`public createFromTimestampMsUTC(mixed $timestamp) : CarbonImmutable`

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.

##### Parameters

$timestamp : mixed

##### Return values

CarbonImmutable

#### createFromTimestampMsUTC()

Factory.php : 0
`public createFromTimestampMsUTC(mixed $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.

##### Parameters

$timestamp : mixed

##### Return values

Carbon

#### createFromTimestampUTC()

FactoryImmutable.php : 0
`public createFromTimestampUTC(string|int|float $timestamp) : CarbonImmutable`

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.

##### Parameters

$timestamp : string|int|float

##### Return values

CarbonImmutable

#### createFromTimestampUTC()

Factory.php : 0
`public createFromTimestampUTC(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.

##### Parameters

$timestamp : string|int|float

##### Return values

Carbon

#### createFromTimeString()

FactoryImmutable.php : 0
`public createFromTimeString(string $time, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

Create a Carbon instance from a time string. The date portion is set to today.

##### Parameters

$time : string
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### createFromTimeString()

Factory.php : 0
`public createFromTimeString(string $time, DateTimeZone|string|int|null $timezone = null) : Carbon`

Create a Carbon instance from a time string. The date portion is set to today.

##### Parameters

$time : string
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### createMidnightDate()

FactoryImmutable.php : 0
`public createMidnightDate(mixed $year, mixed $month, mixed $day, mixed $timezone) : CarbonImmutable`

Create a Carbon instance from just a date. The time portion is set to midnight.

##### Parameters

$year : mixed
$month : mixed
$day : mixed
$timezone : mixed

##### Return values

CarbonImmutable

#### createMidnightDate()

Factory.php : 0
`public createMidnightDate(mixed $year, mixed $month, mixed $day, mixed $timezone) : Carbon`

Create a Carbon instance from just a date. The time portion is set to midnight.

##### Parameters

$year : mixed
$month : mixed
$day : mixed
$timezone : mixed

##### Return values

Carbon

#### createStrict()

FactoryImmutable.php : 0
`public createStrict(int|null $year = 0, int|null $month = 1, int|null $day = 1, int|null $hour = 0, int|null $minute = 0, int|null $second = 0, mixed $timezone) : CarbonImmutable`

Create a new Carbon instance from a specific date and time using strict validation.

##### Parameters

$year = 0 : int|null
$month = 1 : int|null
$day = 1 : int|null
$hour = 0 : int|null
$minute = 0 : int|null
$second = 0 : int|null
$timezone : mixed

##### Return values

CarbonImmutable

#### createStrict()

Factory.php : 0
`public createStrict(int|null $year = 0, int|null $month = 1, int|null $day = 1, int|null $hour = 0, int|null $minute = 0, int|null $second = 0, mixed $timezone) : Carbon`

Create a new Carbon instance from a specific date and time using strict validation.

##### Parameters

$year = 0 : int|null
$month = 1 : int|null
$day = 1 : int|null
$hour = 0 : int|null
$minute = 0 : int|null
$second = 0 : int|null
$timezone : mixed

##### Return values

Carbon

#### disableHumanDiffOption()

Factory.php : 295
`public disableHumanDiffOption(int $humanDiffOption) : void`

##### Parameters

$humanDiffOption : int

#### enableHumanDiffOption()

Factory.php : 290
`public enableHumanDiffOption(mixed $humanDiffOption) : void`

##### Parameters

$humanDiffOption : mixed

#### executeWithLocale()

FactoryImmutable.php : 0
`public executeWithLocale(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).

##### Parameters

$locale : string
$func : callable

#### executeWithLocale()

Factory.php : 0
`public executeWithLocale(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).

##### Parameters

$locale : string
$func : callable

#### fromSerialized()

FactoryImmutable.php : 0
`public fromSerialized(mixed $value) : CarbonImmutable`

Create an instance from a serialized string.

##### Parameters

$value : mixed

##### Return values

CarbonImmutable

#### fromSerialized()

Factory.php : 0
`public fromSerialized(mixed $value) : Carbon`

Create an instance from a serialized string.

##### Parameters

$value : mixed

##### Return values

Carbon

#### genericMacro()

Factory.php : 351

Register a custom macro.

`public genericMacro(callable $macro[, int $priority = 0 ]) : void`

##### Parameters

$macro : callable
$priority : int = 0

  marco with higher priority is tried first

#### getAvailableLocales()

FactoryImmutable.php : 0
`public getAvailableLocales() : array<string|int, mixed>`

Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)

##### Return values

array<string|int, mixed>

#### getAvailableLocales()

Factory.php : 0
`public getAvailableLocales() : array<string|int, mixed>`

Returns the list of internally available locales and already loaded custom locales. (It will ignore custom translator dynamic loading.)

##### Return values

array<string|int, mixed>

#### getAvailableLocalesInfo()

FactoryImmutable.php : 0
`public getAvailableLocalesInfo() : array<string|int, 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.

##### Return values

array<string|int, Language>

#### getAvailableLocalesInfo()

Factory.php : 0
`public getAvailableLocalesInfo() : array<string|int, 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.

##### Return values

array<string|int, Language>

#### getClassName()

Factory.php : 242
`public getClassName() : string`

##### Return values

string

#### getDays()

FactoryImmutable.php : 0
`public getDays() : array<string|int, mixed>`

Get the days of the week.

##### Return values

array<string|int, mixed>

#### getDays()

Factory.php : 0
`public getDays() : array<string|int, mixed>`

Get the days of the week.

##### Return values

array<string|int, mixed>

#### getFormatsToIsoReplacements()

FactoryImmutable.php : 0
`public getFormatsToIsoReplacements() : array<string|int, mixed>`

List of replacements from date() format to isoFormat().

##### Return values

array<string|int, mixed>

#### getFormatsToIsoReplacements()

Factory.php : 0
`public getFormatsToIsoReplacements() : array<string|int, mixed>`

List of replacements from date() format to isoFormat().

##### Return values

array<string|int, mixed>

#### getHumanDiffOptions()

Factory.php : 300
`public getHumanDiffOptions() : int`

##### Return values

int

#### getIsoUnits()

FactoryImmutable.php : 0
`public getIsoUnits() : array<string|int, mixed>`

Returns list of locale units for ISO formatting.

##### Return values

array<string|int, mixed>

#### getIsoUnits()

Factory.php : 0
`public getIsoUnits() : array<string|int, mixed>`

Returns list of locale units for ISO formatting.

##### Return values

array<string|int, mixed>

#### getLastErrors()

FactoryImmutable.php : 0
`public getLastErrors() : array<string|int, mixed>|false`

##### Return values

array<string|int, mixed>|false

#### getLastErrors()

Factory.php : 0
`public getLastErrors() : array<string|int, mixed>|false`

##### Return values

array<string|int, mixed>|false

#### getLocale()

FactoryImmutable.php : 0
`public getLocale() : string`

Get the current translator locale.

##### Return values

string

#### getLocale()

Factory.php : 0
`public getLocale() : string`

Get the current translator locale.

##### Return values

string

#### getMacro()

Factory.php : 378

Get the raw callable macro registered globally for a given name.

`public getMacro(string $name) : callable|null`

##### Parameters

$name : string

##### Return values

callable|null

#### getMidDayAt()

FactoryImmutable.php : 0
`public getMidDayAt() : int`

get midday/noon hour

##### Return values

int

#### getMidDayAt()

Factory.php : 0
`public getMidDayAt() : int`

get midday/noon hour

##### Return values

int

#### getSettings()

Factory.php : 259
`public getSettings() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getTestNow()

Factory.php : 657

Get the Carbon instance (real or mock) to be returned when a "now" instance is created.

`public getTestNow() : Closure|CarbonInterface|null`

##### Return values

Closure|CarbonInterface|null —

the current instance used for testing

#### getTimeFormatByPrecision()

FactoryImmutable.php : 0
`public getTimeFormatByPrecision(string $unitPrecision) : string`

Return a format from H:i to H:i:s.u according to given unit precision.

##### Parameters

$unitPrecision : string

##### Return values

string

#### getTimeFormatByPrecision()

Factory.php : 0
`public getTimeFormatByPrecision(string $unitPrecision) : string`

Return a format from H:i to H:i:s.u according to given unit precision.

##### Parameters

$unitPrecision : string

##### Return values

string

#### getTranslationMessageWith()

FactoryImmutable.php : 0
`public getTranslationMessageWith(mixed $translator, string $key, string|null $locale = null, string|null $default = null) : string|Closure|null`

Returns raw translation message for a given key.

##### Parameters

$translator : mixed
$key : string
$locale = null : string|null
$default = null : string|null

##### Return values

string|Closure|null

#### getTranslationMessageWith()

Factory.php : 0
`public getTranslationMessageWith(mixed $translator, string $key, string|null $locale = null, string|null $default = null) : string|Closure|null`

Returns raw translation message for a given key.

##### Parameters

$translator : mixed
$key : string
$locale = null : string|null
$default = null : string|null

##### Return values

string|Closure|null

#### getTranslator()

Factory.php : 394

Initialize the default translator instance if necessary.

`public getTranslator() : TranslatorInterface`

##### Return values

TranslatorInterface

#### getWeekendDays()

Factory.php : 505

Get weekend days

`public getWeekendDays() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getWeekEndsAt()

FactoryImmutable.php : 0
`public getWeekEndsAt(string|null $locale = null) : int`

Get the last day of week.

##### Parameters

$locale = null : string|null

##### Return values

int

#### getWeekEndsAt()

Factory.php : 0
`public getWeekEndsAt(string|null $locale = null) : int`

Get the last day of week.

##### Parameters

$locale = null : string|null

##### Return values

int

#### getWeekStartsAt()

FactoryImmutable.php : 0
`public getWeekStartsAt(string|null $locale = null) : int`

Get the first day of week.

##### Parameters

$locale = null : string|null

##### Return values

int

#### getWeekStartsAt()

Factory.php : 0
`public getWeekStartsAt(string|null $locale = null) : int`

Get the first day of week.

##### Parameters

$locale = null : string|null

##### Return values

int

#### handleTestNowClosure()

Factory.php : 670
`public handleTestNowClosure(Closure|CarbonInterface|null $testNow[, DateTimeZone|string|int|null $timezone = null ]) : CarbonInterface|null`

##### Parameters

$testNow : Closure|CarbonInterface|null
$timezone : DateTimeZone|string|int|null = null

##### Return values

CarbonInterface|null

#### hasFormat()

Factory.php : 527

Checks if the (date)time string is in a given format.

`public hasFormat(string $date, string $format) : bool`

##### Parameters

$date : string
$format : string

##### Tags

example

      Carbon::hasFormat('11:12:45', 'h:i:s'); // true
      Carbon::hasFormat('13:12:45', 'h:i:s'); // false

##### Return values

bool

#### hasFormatWithModifiers()

Factory.php : 545

Checks if the (date)time string is in a given format.

`public hasFormatWithModifiers(string $date, string $format) : bool`

##### Parameters

$date : string
$format : string

##### Tags

example

      Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true
      Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false

##### Return values

bool

#### hasMacro()

Factory.php : 370

Checks if macro is registered globally.

`public hasMacro(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool

#### hasRelativeKeywords()

FactoryImmutable.php : 0
`public hasRelativeKeywords(string|null $time) : bool`

Determine if a time string will produce a relative date.

##### Parameters

$time : string|null

##### Return values

bool

#### hasRelativeKeywords()

Factory.php : 0
`public hasRelativeKeywords(string|null $time) : bool`

Determine if a time string will produce a relative date.

##### Parameters

$time : string|null

##### Return values

bool

#### hasTestNow()

Factory.php : 708

Determine if there is a valid test instance set. A valid test instance is anything that is not null.

`public hasTestNow() : bool`

##### Return values

bool —

true if there is a test instance, otherwise false

#### instance()

FactoryImmutable.php : 0
`public instance(DateTimeInterface $date) : CarbonImmutable`

Create a Carbon instance from a DateTime one.

##### Parameters

$date : DateTimeInterface

##### Return values

CarbonImmutable

#### instance()

Factory.php : 0
`public instance(DateTimeInterface $date) : Carbon`

Create a Carbon instance from a DateTime one.

##### Parameters

$date : DateTimeInterface

##### Return values

Carbon

#### isImmutable()

FactoryImmutable.php : 0
`public isImmutable() : bool`

Returns true if the current class/instance is immutable.

##### Return values

bool

#### isImmutable()

Factory.php : 0
`public isImmutable() : bool`

Returns true if the current class/instance is immutable.

##### Return values

bool

#### isModifiableUnit()

FactoryImmutable.php : 0
`public isModifiableUnit(mixed $unit) : bool`

Returns true if a property can be changed via setter.

##### Parameters

$unit : mixed

##### Return values

bool

#### isModifiableUnit()

Factory.php : 0
`public isModifiableUnit(mixed $unit) : bool`

Returns true if a property can be changed via setter.

##### Parameters

$unit : mixed

##### Return values

bool

#### isMutable()

FactoryImmutable.php : 0
`public isMutable() : bool`

Returns true if the current class/instance is mutable.

##### Return values

bool

#### isMutable()

Factory.php : 0
`public isMutable() : bool`

Returns true if the current class/instance is mutable.

##### Return values

bool

#### isStrictModeEnabled()

Factory.php : 443

Returns true if the strict mode is globally in use, false else.

`public isStrictModeEnabled() : bool`

(It can be overridden in specific instances.)

##### Return values

bool

#### localeHasDiffOneDayWords()

FactoryImmutable.php : 0
`public localeHasDiffOneDayWords(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasDiffOneDayWords()

Factory.php : 0
`public localeHasDiffOneDayWords(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasDiffSyntax()

FactoryImmutable.php : 0
`public localeHasDiffSyntax(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasDiffSyntax()

Factory.php : 0
`public localeHasDiffSyntax(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasDiffTwoDayWords()

FactoryImmutable.php : 0
`public localeHasDiffTwoDayWords(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasDiffTwoDayWords()

Factory.php : 0
`public localeHasDiffTwoDayWords(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasPeriodSyntax()

FactoryImmutable.php : 0
`public localeHasPeriodSyntax(mixed $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.

##### Parameters

$locale : mixed

##### Return values

bool

#### localeHasPeriodSyntax()

Factory.php : 0
`public localeHasPeriodSyntax(mixed $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.

##### Parameters

$locale : mixed

##### Return values

bool

#### localeHasShortUnits()

FactoryImmutable.php : 0
`public localeHasShortUnits(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.

##### Parameters

$locale : string

##### Return values

bool

#### localeHasShortUnits()

Factory.php : 0
`public localeHasShortUnits(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.

##### Parameters

$locale : string

##### Return values

bool

#### macro()

Factory.php : 322

Register a custom macro.

`public macro(string $name, callable|null $macro) : void`

Pass null macro to remove it.

##### Parameters

$name : string
$macro : callable|null

##### Tags

example

      $userSettings = [
        'locale' => 'pt',
        'timezone' => 'America/Sao_Paulo',
      ];
      $factory->macro('userFormat', function () use ($userSettings) {
        return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar();
      });
      echo $factory->yesterday()->hours(11)->userFormat();

#### mergeSettings()

Factory.php : 276
`public mergeSettings(array<string|int, mixed> $settings) : self`

##### Parameters

$settings : array<string|int, mixed>

##### Return values

self

#### mixin()

FactoryImmutable.php : 0
`public mixin(object|string $mixin) : void`

Mix another object into the class.

##### Parameters

$mixin : object|string

#### mixin()

Factory.php : 0
`public mixin(object|string $mixin) : void`

Mix another object into the class.

##### Parameters

$mixin : object|string

#### now()

Factory.php : 0
`public now(DateTimeZone|string|int|null $timezone = null) : Carbon`

Get a Carbon instance for the current date and time.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### now()

FactoryImmutable.php : 177

Get a Carbon instance for the current date and time.

`public now([DateTimeZone|string|int|null $timezone = null ]) : CarbonImmutable`

##### Parameters

$timezone : DateTimeZone|string|int|null = null

##### Return values

CarbonImmutable

#### parse()

FactoryImmutable.php : 0
`public parse(DateTimeInterface|WeekDay|Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

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

##### Parameters

$time : DateTimeInterface|WeekDay|Month|string|int|float|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### parse()

Factory.php : 0
`public parse(DateTimeInterface|WeekDay|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().

##### Parameters

$time : DateTimeInterface|WeekDay|Month|string|int|float|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### parseFromLocale()

FactoryImmutable.php : 0
`public parseFromLocale(string $time, string|null $locale = null, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).

##### Parameters

$time : string
$locale = null : string|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### parseFromLocale()

Factory.php : 0
`public parseFromLocale(string $time, string|null $locale = null, DateTimeZone|string|int|null $timezone = null) : Carbon`

Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.).

##### Parameters

$time : string
$locale = null : string|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### pluralUnit()

FactoryImmutable.php : 0
`public pluralUnit(string $unit) : string`

Returns standardized plural of a given singular/plural unit name (in English).

##### Parameters

$unit : string

##### Return values

string

#### pluralUnit()

Factory.php : 0
`public pluralUnit(string $unit) : string`

Returns standardized plural of a given singular/plural unit name (in English).

##### Parameters

$unit : string

##### Return values

string

#### rawParse()

FactoryImmutable.php : 0
`public rawParse(DateTimeInterface|WeekDay|Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

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

##### Parameters

$time : DateTimeInterface|WeekDay|Month|string|int|float|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### rawParse()

Factory.php : 0
`public rawParse(DateTimeInterface|WeekDay|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().

##### Parameters

$time : DateTimeInterface|WeekDay|Month|string|int|float|null
$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### resetMacros()

Factory.php : 335

Remove all macros and generic macros.

`public resetMacros() : void`

#### resetMonthsOverflow()

Factory.php : 461

Reset the month overflow behavior.

`public resetMonthsOverflow() : void`

#### resetToStringFormat()

Factory.php : 404

Reset the format used to the default when type juggling a Carbon instance to a string

`public resetToStringFormat() : void`

#### resetYearsOverflow()

Factory.php : 487

Reset the month overflow behavior.

`public resetYearsOverflow() : void`

#### serializeUsing()

Factory.php : 422

JSON serialize all Carbon instances using the given callback.

`public serializeUsing(string|callable|null $format) : void`

##### Parameters

$format : string|callable|null

#### setClassName()

Factory.php : 247
`public setClassName(string $className) : self`

##### Parameters

$className : string

##### Return values

self

#### setFallbackLocale()

FactoryImmutable.php : 0
`public setFallbackLocale(string $locale) : void`

Set the fallback locale.

##### Parameters

$locale : string

#### setFallbackLocale()

Factory.php : 0
`public setFallbackLocale(string $locale) : void`

Set the fallback locale.

##### Parameters

$locale : string

#### setHumanDiffOptions()

Factory.php : 283
`public setHumanDiffOptions(int $humanDiffOptions) : void`

##### Parameters

$humanDiffOptions : int

#### setLocale()

FactoryImmutable.php : 0
`public setLocale(string $locale) : void`

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.

##### Parameters

$locale : string

#### setLocale()

Factory.php : 0
`public setLocale(string $locale) : void`

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.

##### Parameters

$locale : string

#### setMidDayAt()

FactoryImmutable.php : 0
`public setMidDayAt(mixed $hour) : void`

@deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather consider mid-day is always 12pm, then if you need to test if it's an other hour, test it explicitly: $date->format('G') == 13 or to set explicitly to a given hour: $date->setTime(13, 0, 0, 0) Set midday/noon hour

##### Parameters

$hour : mixed

#### setMidDayAt()

Factory.php : 0
`public setMidDayAt(mixed $hour) : void`

@deprecated To avoid conflict between different third-party libraries, static setters should not be used. You should rather consider mid-day is always 12pm, then if you need to test if it's an other hour, test it explicitly: $date->format('G') == 13 or to set explicitly to a given hour: $date->setTime(13, 0, 0, 0) Set midday/noon hour

##### Parameters

$hour : mixed

#### setSettings()

Factory.php : 264
`public setSettings(array<string|int, mixed> $settings) : self`

##### Parameters

$settings : array<string|int, mixed>

##### Return values

self

#### setTestNow()

Factory.php : 572

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

`public setTestNow([DateTimeInterface|Closure|static|string|false|null $testNow = null ]) : void`

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.

##### Parameters

$testNow : DateTimeInterface|Closure|static|string|false|null = null

  real or mock Carbon instance

#### setTestNowAndTimezone()

Factory.php : 599

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

`public setTestNowAndTimezone([DateTimeInterface|Closure|static|string|false|null $testNow = null ][, mixed $timezone = null ]) : void`

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.

##### Parameters

$testNow : DateTimeInterface|Closure|static|string|false|null = null

  real or mock Carbon instance

$timezone : mixed = null

#### settings()

Factory.php : 271
`public settings([array<string|int, mixed>|null $settings = null ]) : self|array<string|int, mixed>`

##### Parameters

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

##### Return values

self|array<string|int, mixed>

#### setToStringFormat()

Factory.php : 412

Set the default format used when type juggling a Carbon instance to a string.

`public setToStringFormat(string|Closure|null $format) : void`

##### Parameters

$format : string|Closure|null

#### setTranslator()

Factory.php : 386

Set the default translator instance to use.

`public setTranslator(TranslatorInterface $translator) : void`

##### Parameters

$translator : TranslatorInterface

#### setWeekendDays()

Factory.php : 513

Set weekend days

`public setWeekendDays(array<string|int, mixed> $days) : void`

##### Parameters

$days : array<string|int, mixed>

#### shouldOverflowMonths()

Factory.php : 469

Get the month overflow global behavior (can be overridden in specific instances).

`public shouldOverflowMonths() : bool`

##### Return values

bool

#### shouldOverflowYears()

Factory.php : 495

Get the month overflow global behavior (can be overridden in specific instances).

`public shouldOverflowYears() : bool`

##### Return values

bool

#### singularUnit()

FactoryImmutable.php : 0
`public singularUnit(string $unit) : string`

Returns standardized singular of a given singular/plural unit name (in English).

##### Parameters

$unit : string

##### Return values

string

#### singularUnit()

Factory.php : 0
`public singularUnit(string $unit) : string`

Returns standardized singular of a given singular/plural unit name (in English).

##### Parameters

$unit : string

##### Return values

string

#### sleep()

Factory.php : 0
`public sleep(int|float $seconds) : void`

##### Parameters

$seconds : int|float

#### sleep()

FactoryImmutable.php : 182
`public sleep(int|float $seconds) : void`

##### Parameters

$seconds : int|float

#### today()

FactoryImmutable.php : 0
`public today(DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

Create a Carbon instance for today.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### today()

Factory.php : 0
`public today(DateTimeZone|string|int|null $timezone = null) : Carbon`

Create a Carbon instance for today.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### tomorrow()

FactoryImmutable.php : 0
`public tomorrow(DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

Create a Carbon instance for tomorrow.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### tomorrow()

Factory.php : 0
`public tomorrow(DateTimeZone|string|int|null $timezone = null) : Carbon`

Create a Carbon instance for tomorrow.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### translateTimeString()

FactoryImmutable.php : 0
`public translateTimeString(string $timeString, string|null $from = null, string|null $to = null, int $mode = CarbonInterface::TRANSLATE_ALL) : string`

Translate a time string from a locale to an other.

##### Parameters

$timeString : string
$from = null : string|null
$to = null : string|null
$mode = CarbonInterface::TRANSLATE_ALL : int

##### Return values

string

#### translateTimeString()

Factory.php : 0
`public translateTimeString(string $timeString, string|null $from = null, string|null $to = null, int $mode = CarbonInterface::TRANSLATE_ALL) : string`

Translate a time string from a locale to an other.

##### Parameters

$timeString : string
$from = null : string|null
$to = null : string|null
$mode = CarbonInterface::TRANSLATE_ALL : int

##### Return values

string

#### translateWith()

FactoryImmutable.php : 0
`public translateWith(TranslatorInterface $translator, string $key, array<string|int, mixed> $parameters = [], mixed $number) : string`

Translate using translation string or callback available.

##### Parameters

$translator : TranslatorInterface
$key : string
$parameters = [] : array<string|int, mixed>
$number : mixed

##### Return values

string

#### translateWith()

Factory.php : 0
`public translateWith(TranslatorInterface $translator, string $key, array<string|int, mixed> $parameters = [], mixed $number) : string`

Translate using translation string or callback available.

##### Parameters

$translator : TranslatorInterface
$key : string
$parameters = [] : array<string|int, mixed>
$number : mixed

##### Return values

string

#### useMonthsOverflow()

Factory.php : 451

Indicates if months should be calculated with overflow.

`public useMonthsOverflow([bool $monthsOverflow = true ]) : void`

##### Parameters

$monthsOverflow : bool = true

#### useStrictMode()

Factory.php : 432

Enable the strict mode (or disable with passing false).

`public useStrictMode([bool $strictModeEnabled = true ]) : void`

##### Parameters

$strictModeEnabled : bool = true

#### useYearsOverflow()

Factory.php : 477

Indicates if years should be calculated with overflow.

`public useYearsOverflow([bool $yearsOverflow = true ]) : void`

##### Parameters

$yearsOverflow : bool = true

#### withTestNow()

Factory.php : 638

Temporarily sets a static date to be used within the callback.

`public withTestNow(DateTimeInterface|Closure|static|string|false|null $testNow, callable $callback) : T`

Using setTestNow to set the date, executing the callback, then clearing the test instance.

/!\ Use this method for unit tests only.

##### Parameters

$testNow : DateTimeInterface|Closure|static|string|false|null

  real or mock Carbon instance

$callback : callable

##### Tags

template

  T

##### Return values

T

#### withTimeZone()

Factory.php : 713
`public withTimeZone(DateTimeZone|string|int|null $timezone) : static`

##### Parameters

$timezone : DateTimeZone|string|int|null

##### Return values

static

#### yesterday()

FactoryImmutable.php : 0
`public yesterday(DateTimeZone|string|int|null $timezone = null) : CarbonImmutable`

Create a Carbon instance for yesterday.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

CarbonImmutable

#### yesterday()

Factory.php : 0
`public yesterday(DateTimeZone|string|int|null $timezone = null) : Carbon`

Create a Carbon instance for yesterday.

##### Parameters

$timezone = null : DateTimeZone|string|int|null

##### Return values

Carbon

#### getMockedTestNow()

Factory.php : 772

Get the mocked date passed in setTestNow() and if it's a Closure, execute it.

`protected getMockedTestNow(DateTimeZone|string|int|null $timezone) : CarbonInterface|null`

##### Parameters

$timezone : DateTimeZone|string|int|null

##### Return values

CarbonInterface|null

#### matchFormatPattern()

Factory.php : 803

Checks if the (date)time string is in a given format with given list of pattern replacements.

`private matchFormatPattern(string $date, string $format, array<string|int, mixed> $replacements) : bool`

##### Parameters

$date : string
$format : string
$replacements : array<string|int, mixed>

##### Tags

example

      Carbon::hasFormat('11:12:45', 'h:i:s'); // true
      Carbon::hasFormat('13:12:45', 'h:i:s'); // false

##### Return values

bool

#### setDefaultTimezone()

Factory.php : 821
`private setDefaultTimezone(string $timezone[, DateTimeInterface|null $date = null ]) : void`

##### Parameters

$timezone : string
$date : DateTimeInterface|null = null

## Search results