DateFactory
class DateFactory
Constants
| DEFAULT_CLASS_NAME |
The default class that will be used for all created dates. |
Properties
| static protected null|CarbonInterface> | $dateClass | The type (class) of dates that should be created. |
|
| static protected Closure|null | $callable | This callable may be used to intercept date creation. |
|
| static protected Factory|null | $factory | The Carbon factory that should be used when creating dates. |
Methods
Use the given handler when generating dates (class name, callable, or factory).
Use the default date class when generating dates.
Execute the given callable on each date creation.
Use the given date type (class) when generating dates.
Use the given Carbon factory when generating dates.
Flush all static state.
Handle dynamic calls to generate dates.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
at line 145
static void
use(mixed $handler)
Use the given handler when generating dates (class name, callable, or factory).
Boot-only. The selected handler persists in static state for the worker lifetime and affects date creation in every subsequent request.
at line 173
static void
useDefault()
Use the default date class when generating dates.
Boot-only. Clearing the worker-wide handler affects date creation in every subsequent request.
at line 186
static void
useCallable(callable $callable)
Execute the given callable on each date creation.
Boot-only. The callable persists in a static property for the worker lifetime and runs on every date creation across all coroutines.
at line 202
static void
useClass(string $dateClass)
Use the given date type (class) when generating dates.
Boot-only. The class name persists in a static property for the worker lifetime and is used for every date creation across all coroutines.
at line 225
static void
useFactory(Factory $factory)
Use the given Carbon factory when generating dates.
Boot-only. The factory persists in a static property for the worker lifetime and is used for every date creation across all coroutines.
at line 236
static void
flushState()
Flush all static state.
at line 244
mixed
__call(string $method, array $parameters)
Handle dynamic calls to generate dates.
at line 111
bool
canBeCreatedFromFormat(?string $date, string $format)
No description
at line 111
CarbonInterface
create(mixed $year = '0', mixed $month = '1', mixed $day = '1', mixed $hour = '0', mixed $minute = '0', mixed $second = '0', mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromDate(mixed $year = 'null', mixed $month = 'null', mixed $day = 'null', mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromFormat(mixed $format, mixed $time, mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromIsoFormat(string $format, string $time, mixed $timezone = 'null', ?string $locale = '\'en\'', TranslatorInterface $translator = 'null')
No description
at line 111
CarbonInterface
createFromLocaleFormat(string $format, string $locale, string $time, mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromLocaleIsoFormat(string $format, string $locale, string $time, mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromTime(mixed $hour = '0', mixed $minute = '0', mixed $second = '0', mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createFromTimeString(string $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
createFromTimestamp(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
createFromTimestampMs(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
createFromTimestampMsUTC(mixed $timestamp)
No description
at line 111
CarbonInterface
createFromTimestampUTC(float|int|string $timestamp)
No description
at line 111
CarbonInterface
createMidnightDate(mixed $year = 'null', mixed $month = 'null', mixed $day = 'null', mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createSafe(mixed $year = 'null', mixed $month = 'null', mixed $day = 'null', mixed $hour = 'null', mixed $minute = 'null', mixed $second = 'null', mixed $timezone = 'null')
No description
at line 111
CarbonInterface
createStrict(?int $year = '0', ?int $month = '1', ?int $day = '1', ?int $hour = '0', ?int $minute = '0', ?int $second = '0', mixed $timezone = 'null')
No description
at line 111
void
disableHumanDiffOption(mixed $humanDiffOption)
No description
at line 111
void
enableHumanDiffOption(mixed $humanDiffOption)
No description
at line 111
mixed
executeWithLocale(string $locale, callable $func)
No description
at line 111
CarbonInterface
fromSerialized(mixed $value)
No description
at line 111
array
getAvailableLocales()
No description
at line 111
array
getAvailableLocalesInfo()
No description
at line 111
array
getDays()
No description
at line 111
null|string
getFallbackLocale()
No description
at line 111
array
getFormatsToIsoReplacements()
No description
at line 111
int
getHumanDiffOptions()
No description
at line 111
array
getIsoUnits()
No description
at line 111
array|false
getLastErrors()
No description
at line 111
string
getLocale()
No description
at line 111
int
getMidDayAt()
No description
at line 111
string
getTimeFormatByPrecision(string $unitPrecision)
No description
at line 111
Closure|string
getTranslationMessageWith(mixed $translator, string $key, ?string $locale = 'null', ?string $default = 'null')
No description
at line 111
CarbonInterface
getTestNow()
No description
at line 111
TranslatorInterface
getTranslator()
No description
at line 111
int
getWeekEndsAt(?string $locale = 'null')
No description
at line 111
int
getWeekStartsAt(?string $locale = 'null')
No description
at line 111
array
getWeekendDays()
No description
at line 111
bool
hasFormat(string $date, string $format)
No description
at line 111
bool
hasFormatWithModifiers(string $date, string $format)
No description
at line 111
bool
hasMacro(mixed $name)
No description
at line 111
bool
hasRelativeKeywords(?string $time)
No description
at line 111
bool
hasTestNow()
No description
at line 111
CarbonInterface
instance(DateTimeInterface $date)
No description
at line 111
bool
isImmutable()
No description
at line 111
bool
isModifiableUnit(mixed $unit)
No description
at line 111
bool
isMutable()
No description
at line 111
bool
isStrictModeEnabled()
No description
at line 111
bool
localeHasDiffOneDayWords(string $locale)
No description
at line 111
bool
localeHasDiffSyntax(string $locale)
No description
at line 111
bool
localeHasDiffTwoDayWords(string $locale)
No description
at line 111
bool
localeHasPeriodSyntax(mixed $locale)
No description
at line 111
bool
localeHasShortUnits(string $locale)
No description
at line 111
void
macro(string $name, ?callable $macro)
No description
at line 111
CarbonInterface
make(mixed $var, DateTimeZone|string|null $timezone = 'null')
No description
at line 111
void
mixin(object|string $mixin)
No description
at line 111
CarbonInterface
now(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
parse(Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
parseFromLocale(string $time, ?string $locale = 'null', DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
string
pluralUnit(string $unit)
No description
at line 111
CarbonInterface
rawCreateFromFormat(string $format, string $time, mixed $timezone = 'null')
No description
at line 111
CarbonInterface
rawParse(Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
void
resetMonthsOverflow()
No description
at line 111
void
resetToStringFormat()
No description
at line 111
void
resetYearsOverflow()
No description
at line 111
void
serializeUsing(mixed $callback)
No description
at line 111
void
setHumanDiffOptions(mixed $humanDiffOptions)
No description
at line 111
void
setFallbackLocale(string $locale)
No description
at line 111
void
setLocale(string $locale)
No description
at line 111
void
setMidDayAt(mixed $hour)
No description
at line 111
void
setTestNow(mixed $testNow = 'null')
No description
at line 111
void
setTestNowAndTimezone(mixed $testNow = 'null', mixed $timezone = 'null')
No description
at line 111
void
setToStringFormat(Closure|string $format)
No description
at line 111
void
setTranslator(TranslatorInterface $translator)
No description
at line 111
void
setWeekendDays(mixed $days)
No description
at line 111
bool
shouldOverflowMonths()
No description
at line 111
bool
shouldOverflowYears()
No description
at line 111
string
singularUnit(string $unit)
No description
at line 111
void
sleep(float|int $seconds)
No description
at line 111
CarbonInterface
today(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
CarbonInterface
tomorrow(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 111
string
translateTimeString(string $timeString, ?string $from = 'null', ?string $to = 'null', int $mode = '\\Carbon\\CarbonInterface::TRANSLATE_ALL')
No description
at line 111
string
translateWith(TranslatorInterface $translator, string $key, array $parameters = '[]', mixed $number = 'null')
No description
at line 111
void
useMonthsOverflow(mixed $monthsOverflow = 'true')
No description
at line 111
void
useStrictMode(mixed $strictModeEnabled = 'true')
No description
at line 111
void
useYearsOverflow(mixed $yearsOverflow = 'true')
No description
at line 111
mixed
withTestNow(mixed $testNow, callable $callback)
No description
at line 111
Factory
withTimeZone(DateTimeZone|int|string $timezone)
No description
at line 111
CarbonInterface
yesterday(DateTimeZone|string|int|null $timezone = 'null')
No description