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 140
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 168
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 181
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 197
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 220
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 231
static void
flushState()
Flush all static state.
at line 239
mixed
__call(string $method, array $parameters)
Handle dynamic calls to generate dates.
at line 106
bool
canBeCreatedFromFormat(?string $date, string $format)
No description
at line 106
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 106
CarbonInterface
createFromDate(mixed $year = 'null', mixed $month = 'null', mixed $day = 'null', mixed $timezone = 'null')
No description
at line 106
CarbonInterface
createFromFormat(mixed $format, mixed $time, mixed $timezone = 'null')
No description
at line 106
CarbonInterface
createFromIsoFormat(string $format, string $time, mixed $timezone = 'null', ?string $locale = '\'en\'', TranslatorInterface $translator = 'null')
No description
at line 106
CarbonInterface
createFromLocaleFormat(string $format, string $locale, string $time, mixed $timezone = 'null')
No description
at line 106
CarbonInterface
createFromLocaleIsoFormat(string $format, string $locale, string $time, mixed $timezone = 'null')
No description
at line 106
CarbonInterface
createFromTime(mixed $hour = '0', mixed $minute = '0', mixed $second = '0', mixed $timezone = 'null')
No description
at line 106
CarbonInterface
createFromTimeString(string $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
createFromTimestamp(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
createFromTimestampMs(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
createFromTimestampMsUTC(mixed $timestamp)
No description
at line 106
CarbonInterface
createFromTimestampUTC(float|int|string $timestamp)
No description
at line 106
CarbonInterface
createMidnightDate(mixed $year = 'null', mixed $month = 'null', mixed $day = 'null', mixed $timezone = 'null')
No description
at line 106
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 106
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 106
void
disableHumanDiffOption(mixed $humanDiffOption)
No description
at line 106
void
enableHumanDiffOption(mixed $humanDiffOption)
No description
at line 106
mixed
executeWithLocale(string $locale, callable $func)
No description
at line 106
CarbonInterface
fromSerialized(mixed $value)
No description
at line 106
array
getAvailableLocales()
No description
at line 106
array
getAvailableLocalesInfo()
No description
at line 106
array
getDays()
No description
at line 106
null|string
getFallbackLocale()
No description
at line 106
array
getFormatsToIsoReplacements()
No description
at line 106
int
getHumanDiffOptions()
No description
at line 106
array
getIsoUnits()
No description
at line 106
array|false
getLastErrors()
No description
at line 106
string
getLocale()
No description
at line 106
int
getMidDayAt()
No description
at line 106
string
getTimeFormatByPrecision(string $unitPrecision)
No description
at line 106
Closure|string
getTranslationMessageWith(mixed $translator, string $key, ?string $locale = 'null', ?string $default = 'null')
No description
at line 106
CarbonInterface
getTestNow()
No description
at line 106
TranslatorInterface
getTranslator()
No description
at line 106
int
getWeekEndsAt(?string $locale = 'null')
No description
at line 106
int
getWeekStartsAt(?string $locale = 'null')
No description
at line 106
array
getWeekendDays()
No description
at line 106
bool
hasFormat(string $date, string $format)
No description
at line 106
bool
hasFormatWithModifiers(string $date, string $format)
No description
at line 106
bool
hasMacro(mixed $name)
No description
at line 106
bool
hasRelativeKeywords(?string $time)
No description
at line 106
bool
hasTestNow()
No description
at line 106
CarbonInterface
instance(DateTimeInterface $date)
No description
at line 106
bool
isImmutable()
No description
at line 106
bool
isModifiableUnit(mixed $unit)
No description
at line 106
bool
isMutable()
No description
at line 106
bool
isStrictModeEnabled()
No description
at line 106
bool
localeHasDiffOneDayWords(string $locale)
No description
at line 106
bool
localeHasDiffSyntax(string $locale)
No description
at line 106
bool
localeHasDiffTwoDayWords(string $locale)
No description
at line 106
bool
localeHasPeriodSyntax(mixed $locale)
No description
at line 106
bool
localeHasShortUnits(string $locale)
No description
at line 106
void
macro(string $name, ?callable $macro)
No description
at line 106
CarbonInterface
make(mixed $var, DateTimeZone|string|null $timezone = 'null')
No description
at line 106
void
mixin(object|string $mixin)
No description
at line 106
CarbonInterface
now(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
parse(Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
parseFromLocale(string $time, ?string $locale = 'null', DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
string
pluralUnit(string $unit)
No description
at line 106
CarbonInterface
rawCreateFromFormat(string $format, string $time, mixed $timezone = 'null')
No description
at line 106
CarbonInterface
rawParse(Month|string|int|float|null $time, DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
void
resetMonthsOverflow()
No description
at line 106
void
resetToStringFormat()
No description
at line 106
void
resetYearsOverflow()
No description
at line 106
void
serializeUsing(mixed $callback)
No description
at line 106
void
setHumanDiffOptions(mixed $humanDiffOptions)
No description
at line 106
void
setFallbackLocale(string $locale)
No description
at line 106
void
setLocale(string $locale)
No description
at line 106
void
setMidDayAt(mixed $hour)
No description
at line 106
void
setTestNow(mixed $testNow = 'null')
No description
at line 106
void
setTestNowAndTimezone(mixed $testNow = 'null', mixed $timezone = 'null')
No description
at line 106
void
setToStringFormat(Closure|string $format)
No description
at line 106
void
setTranslator(TranslatorInterface $translator)
No description
at line 106
void
setWeekendDays(mixed $days)
No description
at line 106
bool
shouldOverflowMonths()
No description
at line 106
bool
shouldOverflowYears()
No description
at line 106
string
singularUnit(string $unit)
No description
at line 106
void
sleep(float|int $seconds)
No description
at line 106
CarbonInterface
today(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
CarbonInterface
tomorrow(DateTimeZone|string|int|null $timezone = 'null')
No description
at line 106
string
translateTimeString(string $timeString, ?string $from = 'null', ?string $to = 'null', int $mode = '\\Carbon\\CarbonInterface::TRANSLATE_ALL')
No description
at line 106
string
translateWith(TranslatorInterface $translator, string $key, array $parameters = '[]', mixed $number = 'null')
No description
at line 106
void
useMonthsOverflow(mixed $monthsOverflow = 'true')
No description
at line 106
void
useStrictMode(mixed $strictModeEnabled = 'true')
No description
at line 106
void
useYearsOverflow(mixed $yearsOverflow = 'true')
No description
at line 106
mixed
withTestNow(mixed $testNow, callable $callback)
No description
at line 106
Factory
withTimeZone(DateTimeZone|int|string $timezone)
No description
at line 106
CarbonInterface
yesterday(DateTimeZone|string|int|null $timezone = 'null')
No description