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