Class Time
Extends time class provided by Chronos.
Adds handy methods and locale-aware formatting helpers.
Constants
Property Summary
-
$formatters protected static
array<string, \IntlDateFormatter>In-memory cache of date formatters
-
$jsonEncodeFormat protected static
Closure|string|intThe format to use when converting this object to JSON.
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
-
$niceFormat public static
string|intThe format to use when formatting a time using
Cake\I18n\Time::nice()The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
-
$ticks protected
int -
$toStringFormat protected static
array|string|intThe format to use when formatting a time using
Cake\I18n\Time::i18nFormat()and__toString.The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
Method Summary
-
__construct() public
Copies time from onther instance or from time string in the format HH[:.]mm or HH[:.]mm[:.]ss.u.
Defaults to server time.
-
__toString() public
Format the instance as a string using the set format
-
addHours() public
Returns a new instance with the given number of hours added.
Arithmetic wraps around midnight: adding 2 hours to 23:00:00 yields 01:00:00; subtracting 2 hours from 00:00:00 yields 22:00:00.
-
addMinutes() public
Returns a new instance with the given number of minutes added.
Wraps around midnight like {@see self::addHours()}.
-
addSeconds() public
Returns a new instance with the given number of seconds added.
Wraps around midnight like {@see self::addHours()}.
-
addTicks() protected
Adds a tick (microsecond) delta and wraps into [0, TICKS_PER_DAY).
-
between() public
Returns whether time is between time range.
-
closest() public
Returns the ChronosTime closest to this instance.
-
diff() public
Returns the difference between this time and a target time as a DateInterval.
Matches the signature of
DateTimeInterface::diff()— defaults to a signed interval. Pass$absolute = trueto drop the sign. -
diffInHours() public
Returns the difference in whole hours between this time and another.
-
diffInMinutes() public
Returns the difference in whole minutes between this time and another.
-
diffInSeconds() public
Returns the difference in whole seconds between this time and another.
-
diffInTicks() protected
-
endOfDay() public static
Returns instance set to end of day - either 23:59:59 or 23:59:59.999999 if
$microsecondsis true -
endOfHour() public
Sets time to the end of the current hour.
-
equals() public
Returns whether time is equal to target time.
-
farthest() public
Returns the ChronosTime farthest from this instance.
-
format() public
Formats string using the same syntax as
DateTimeImmutable::format().As this uses DateTimeImmutable::format() to format the string, non-time formatters will still be interpreted. Be sure to escape those characters first.
-
formatObject() protected
Returns a translated and localized date string. Implements what IntlDateFormatter::formatObject() is in PHP 5.5+
-
getHours() public
Returns clock hours.
-
getMicroseconds() public
Returns clock microseconds.
-
getMinutes() public
Returns clock minutes.
-
getSeconds() public
Return clock seconds.
-
greaterThan() public
Returns whether time is greater than target time.
-
greaterThanOrEquals() public
Returns whether time is greater than or equal to target time.
-
i18nFormat() public
Returns a formatted string for this time object using the preferred format and language for the specified locale.
It is possible to specify the desired format for the string to be displayed. You can either pass
IntlDateFormatterconstants as the first argument of this function, or pass a full ICU date formatting string as specified in the following resource: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax.Examples
$time = new Time('23:10:10'); $time->i18nFormat(); $time->i18nFormat(\IntlDateFormatter::FULL); $time->i18nFormat("HH':'mm':'ss");You can control the default format used through
Time::setToStringFormat().You can read about the available IntlDateFormatter constants at https://secure.php.net/manual/en/class.intldateformatter.php
Should you need to use a different locale for displaying this time object, pass a locale string as the third parameter to this function.
Examples
$time = new Time('2014-04-20'); $time->i18nFormat('de-DE'); $time->i18nFormat(\IntlDateFormatter::FULL, 'de-DE');You can control the default locale used through
DateTime::setDefaultLocale(). If empty, the default will be taken from theintl.default_localeini config. -
isEndOfDay() public
Returns whether time is end of day.
Compares against 23:59:59, ignoring microseconds.
-
isMidday() public
Returns whether time is midday.
-
isMidnight() public
Returns whether time is midnight.
-
isStartOfDay() public
Returns whether time is start of day.
-
jsonSerialize() public
Returns a string that should be serialized when converting this object to JSON
-
lessThan() public
Returns whether time is less than target time.
-
lessThanOrEquals() public
Returns whether time is less than or equal to target time.
-
max() public
Returns the larger of this instance and the other.
-
midnight() public static
Returns instance set to midnight.
-
min() public
Returns the smaller of this instance and the other.
-
mod() protected static
-
modify() public
Applies a date/time modifier string.
Only time-component modifiers are accepted: combinations of signed integers followed by
hour(s),minute(s),second(s), ormicrosecond(s). Date components (day,week,month,year) are not allowed and will throw. The result wraps around midnight. -
nice() public
Returns a nicely formatted date string for this object.
The format to be used is stored in the static property
Time::$niceFormat. -
noon() public static
Returns instance set to noon.
-
now() public static
Returns instance set to server time.
-
parse() public static
Copies time from onther instance or from string in the format HH[:.]mm or HH[:.]mm[:.]ss.u
Defaults to server time.
-
parseString() protected static
-
parseTime() public static
Returns a new Time object after parsing the provided $time string based on the passed or configured date time format. This method is locale dependent, Any string passed to this function will be interpreted as a locale dependent string.
When no $format is provided, the IntlDateFormatter::SHORT format will be used.
If it was impossible to parse the provided time, null will be returned.
Example:
$time = Time::parseTime('11:23pm'); -
processDateTime() protected static
Returns a new Time object after parsing the provided time string based on the passed or configured date time format. This method is locale dependent, Any string that is passed to this function will be interpreted as a locale dependent string.
Unlike DateTime, the time zone of the returned instance is always converted to
$tz(default time zone if null) even if the$timestring specified a time zone. This is a limitation of IntlDateFormatter.If it was impossible to parse the provided time, null will be returned.
Example:
$time = Time::parseDateTime('10/13/2013 12:54am'); $time = Time::parseDateTime('13 Oct, 2013 13:54', 'dd MMM, y H:mm'); $time = Time::parseDateTime('10/10/2015', [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]); -
resetToStringFormat() public static
Resets the format used to the default when converting an instance of this type to a string
-
secondsSinceMidnight() public
Returns the number of whole seconds since midnight.
-
setHours() public
Set clock hours.
-
setJsonEncodeFormat() public static
Sets the default format used when converting this object to JSON
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details)
Alternatively, the format can provide a callback. In this case, the callback can receive this object and return a formatted string.
-
setMicroseconds() public
Sets clock microseconds.
-
setMinutes() public
Set clock minutes.
-
setSeconds() public
Set clock seconds.
-
setTime() public
Sets clock time.
-
setToStringFormat() public static
Sets the default format used when type converting instances of this type to string
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
-
startOfHour() public
Resets time to the start of the current hour.
-
subHours() public
Returns a new instance with the given number of hours subtracted.
Wraps around midnight like {@see self::addHours()}.
-
subMinutes() public
Returns a new instance with the given number of minutes subtracted.
Wraps around midnight like {@see self::addHours()}.
-
subSeconds() public
Returns a new instance with the given number of seconds subtracted.
Wraps around midnight like {@see self::addHours()}.
-
toArray() public
Returns the time as an associative array.
-
toDateTimeImmutable() public
Returns an
DateTimeImmutableinstance set to this clock time. -
toNative() public
Returns an
DateTimeImmutableinstance set to this clock time.Alias of
toDateTimeImmutable(). -
withTicks() protected
Returns a clone with the given absolute tick value.
Method Detail
__construct() ¶ public
__construct(Cake\Chronos\ChronosTime|DateTimeInterface|string|null $time = null, DateTimeZone|string|null $timezone = null)
Copies time from onther instance or from time string in the format HH[:.]mm or HH[:.]mm[:.]ss.u.
Defaults to server time.
Parameters
-
Cake\Chronos\ChronosTime|DateTimeInterface|string|null$time optional Time
-
DateTimeZone|string|null$timezone optional The timezone to use for now
__toString() ¶ public
__toString(): string
Format the instance as a string using the set format
Returns
stringaddHours() ¶ public
addHours(int $value): static
Returns a new instance with the given number of hours added.
Arithmetic wraps around midnight: adding 2 hours to 23:00:00 yields 01:00:00; subtracting 2 hours from 00:00:00 yields 22:00:00.
Parameters
-
int$value Hours to add
Returns
staticaddMinutes() ¶ public
addMinutes(int $value): static
Returns a new instance with the given number of minutes added.
Wraps around midnight like {@see self::addHours()}.
Parameters
-
int$value Minutes to add
Returns
staticaddSeconds() ¶ public
addSeconds(int $value): static
Returns a new instance with the given number of seconds added.
Wraps around midnight like {@see self::addHours()}.
Parameters
-
int$value Seconds to add
Returns
staticaddTicks() ¶ protected
addTicks(int $delta): static
Adds a tick (microsecond) delta and wraps into [0, TICKS_PER_DAY).
Parameters
-
int$delta Delta to add
Returns
staticbetween() ¶ public
between(Cake\Chronos\ChronosTime $start, Cake\Chronos\ChronosTime $end, bool $equals = true): bool
Returns whether time is between time range.
Parameters
-
Cake\Chronos\ChronosTime$start Start of target range
-
Cake\Chronos\ChronosTime$end End of target range
-
bool$equals optional Whether to include the beginning and end of range
Returns
boolclosest() ¶ public
closest(Cake\Chronos\ChronosTime $first, Cake\Chronos\ChronosTime $second, Cake\Chronos\ChronosTime ...$others): static
Returns the ChronosTime closest to this instance.
Parameters
-
Cake\Chronos\ChronosTime$first First candidate
-
Cake\Chronos\ChronosTime$second Second candidate
-
Cake\Chronos\ChronosTime...$others Additional candidates
Returns
staticdiff() ¶ public
diff(Cake\Chronos\ChronosTime $target, bool $absolute = false): DateInterval
Returns the difference between this time and a target time as a DateInterval.
Matches the signature of DateTimeInterface::diff() — defaults to a
signed interval. Pass $absolute = true to drop the sign.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
-
bool$absolute optional Whether to return an absolute interval
Returns
DateIntervaldiffInHours() ¶ public
diffInHours(Cake\Chronos\ChronosTime|null $other = null, bool $absolute = true): int
Returns the difference in whole hours between this time and another.
Parameters
-
Cake\Chronos\ChronosTime|null$other optional Target time, defaults to now
-
bool$absolute optional Whether to return an absolute value
Returns
intdiffInMinutes() ¶ public
diffInMinutes(Cake\Chronos\ChronosTime|null $other = null, bool $absolute = true): int
Returns the difference in whole minutes between this time and another.
Parameters
-
Cake\Chronos\ChronosTime|null$other optional Target time, defaults to now
-
bool$absolute optional Whether to return an absolute value
Returns
intdiffInSeconds() ¶ public
diffInSeconds(Cake\Chronos\ChronosTime|null $other = null, bool $absolute = true): int
Returns the difference in whole seconds between this time and another.
Parameters
-
Cake\Chronos\ChronosTime|null$other optional Target time, defaults to now
-
bool$absolute optional Whether to return an absolute value
Returns
intdiffInTicks() ¶ protected
diffInTicks(Cake\Chronos\ChronosTime|null $other, bool $absolute): int
Parameters
-
Cake\Chronos\ChronosTime|null$other Target time, defaults to now
-
bool$absolute Whether to return an absolute value
Returns
intendOfDay() ¶ public static
endOfDay(bool $microseconds = false): static
Returns instance set to end of day - either
23:59:59 or 23:59:59.999999 if $microseconds is true
Parameters
-
bool$microseconds optional Whether to set microseconds or not
Returns
staticequals() ¶ public
equals(Cake\Chronos\ChronosTime $target): bool
Returns whether time is equal to target time.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
Returns
boolfarthest() ¶ public
farthest(Cake\Chronos\ChronosTime $first, Cake\Chronos\ChronosTime $second, Cake\Chronos\ChronosTime ...$others): static
Returns the ChronosTime farthest from this instance.
Parameters
-
Cake\Chronos\ChronosTime$first First candidate
-
Cake\Chronos\ChronosTime$second Second candidate
-
Cake\Chronos\ChronosTime...$others Additional candidates
Returns
staticformat() ¶ public
format(string $format): string
Formats string using the same syntax as DateTimeImmutable::format().
As this uses DateTimeImmutable::format() to format the string, non-time formatters will still be interpreted. Be sure to escape those characters first.
Parameters
-
string$format Format string
Returns
stringformatObject() ¶ protected
formatObject(DateTimeInterface $date, array<int>|string $format, string|null $locale): string
Returns a translated and localized date string. Implements what IntlDateFormatter::formatObject() is in PHP 5.5+
Parameters
-
DateTimeInterface$date Date.
-
array<int>|string$format Format.
-
string|null$locale The locale name in which the date should be displayed.
Returns
stringgreaterThan() ¶ public
greaterThan(Cake\Chronos\ChronosTime $target): bool
Returns whether time is greater than target time.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
Returns
boolgreaterThanOrEquals() ¶ public
greaterThanOrEquals(Cake\Chronos\ChronosTime $target): bool
Returns whether time is greater than or equal to target time.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
Returns
booli18nFormat() ¶ public
i18nFormat(string|int|null $format = null, string|null $locale = null): string|int
Returns a formatted string for this time object using the preferred format and language for the specified locale.
It is possible to specify the desired format for the string to be displayed.
You can either pass IntlDateFormatter constants as the first argument of this
function, or pass a full ICU date formatting string as specified in the following
resource: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax.
Examples
$time = new Time('23:10:10');
$time->i18nFormat();
$time->i18nFormat(\IntlDateFormatter::FULL);
$time->i18nFormat("HH':'mm':'ss");
You can control the default format used through Time::setToStringFormat().
You can read about the available IntlDateFormatter constants at https://secure.php.net/manual/en/class.intldateformatter.php
Should you need to use a different locale for displaying this time object, pass a locale string as the third parameter to this function.
Examples
$time = new Time('2014-04-20');
$time->i18nFormat('de-DE');
$time->i18nFormat(\IntlDateFormatter::FULL, 'de-DE');
You can control the default locale used through DateTime::setDefaultLocale().
If empty, the default will be taken from the intl.default_locale ini config.
Parameters
-
string|int|null$format optional Format string.
-
string|null$locale optional The locale name in which the time should be displayed (e.g. pt-BR)
Returns
string|intFormatted and translated time string
isEndOfDay() ¶ public
isEndOfDay(): bool
Returns whether time is end of day.
Compares against 23:59:59, ignoring microseconds.
Returns
booljsonSerialize() ¶ public
jsonSerialize(): string|int
Returns a string that should be serialized when converting this object to JSON
Returns
string|intlessThan() ¶ public
lessThan(Cake\Chronos\ChronosTime $target): bool
Returns whether time is less than target time.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
Returns
boollessThanOrEquals() ¶ public
lessThanOrEquals(Cake\Chronos\ChronosTime $target): bool
Returns whether time is less than or equal to target time.
Parameters
-
Cake\Chronos\ChronosTime$target Target time
Returns
boolmax() ¶ public
max(Cake\Chronos\ChronosTime|null $other = null): static
Returns the larger of this instance and the other.
Parameters
-
Cake\Chronos\ChronosTime|null$other optional Target time, defaults to now
Returns
staticmin() ¶ public
min(Cake\Chronos\ChronosTime|null $other = null): static
Returns the smaller of this instance and the other.
Parameters
-
Cake\Chronos\ChronosTime|null$other optional Target time, defaults to now
Returns
staticmodify() ¶ public
modify(string $modifier): static
Applies a date/time modifier string.
Only time-component modifiers are accepted: combinations of signed
integers followed by hour(s), minute(s), second(s), or
microsecond(s). Date components (day, week, month, year)
are not allowed and will throw. The result wraps around midnight.
Parameters
-
string$modifier Modifier string (e.g.
+2 hours,-30 minutes)
Returns
staticThrows
InvalidArgumentExceptionWhen the modifier is invalid or contains date units.
nice() ¶ public
nice(string|null $locale = null): string
Returns a nicely formatted date string for this object.
The format to be used is stored in the static property Time::$niceFormat.
Parameters
-
string|null$locale optional The locale name in which the date should be displayed (e.g. pt-BR)
Returns
stringFormatted date string
now() ¶ public static
now(DateTimeZone|string|null $timezone = null): static
Returns instance set to server time.
Parameters
-
DateTimeZone|string|null$timezone optional The timezone to use for now
Returns
staticparse() ¶ public static
parse(Cake\Chronos\ChronosTime|DateTimeInterface|string $time = null, DateTimeZone|string|null $timezone = null): static
Copies time from onther instance or from string in the format HH[:.]mm or HH[:.]mm[:.]ss.u
Defaults to server time.
Parameters
-
Cake\Chronos\ChronosTime|DateTimeInterface|string$time optional Time
-
DateTimeZone|string|null$timezone optional The timezone to use for now
Returns
staticparseString() ¶ protected static
parseString(string $time): int
Parameters
-
string$time Time string in the format HH[:.]mm or HH[:.]mm[:.]ss.u
Returns
intparseTime() ¶ public static
parseTime(string $time, string|int|null $format = null): static|null
Returns a new Time object after parsing the provided $time string based on the passed or configured date time format. This method is locale dependent, Any string passed to this function will be interpreted as a locale dependent string.
When no $format is provided, the IntlDateFormatter::SHORT format will be used.
If it was impossible to parse the provided time, null will be returned.
Example:
$time = Time::parseTime('11:23pm');
Parameters
-
string$time The time string to parse.
-
string|int|null$format optional Any format accepted by IntlDateFormatter.
Returns
static|nullprocessDateTime() ¶ protected static
processDateTime(string $time, array<int>|string $format, DateTimeZone|string|null $tz = null): static|null
Returns a new Time object after parsing the provided time string based on the passed or configured date time format. This method is locale dependent, Any string that is passed to this function will be interpreted as a locale dependent string.
Unlike DateTime, the time zone of the returned instance is always converted
to $tz (default time zone if null) even if the $time string specified a
time zone. This is a limitation of IntlDateFormatter.
If it was impossible to parse the provided time, null will be returned.
Example:
$time = Time::parseDateTime('10/13/2013 12:54am');
$time = Time::parseDateTime('13 Oct, 2013 13:54', 'dd MMM, y H:mm');
$time = Time::parseDateTime('10/10/2015', [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]);
Parameters
-
string$time The time string to parse.
-
array<int>|string$format Any format accepted by IntlDateFormatter.
-
DateTimeZone|string|null$tz optional The timezone for the instance
Returns
static|nullresetToStringFormat() ¶ public static
resetToStringFormat(): void
Resets the format used to the default when converting an instance of this type to a string
Returns
voidsecondsSinceMidnight() ¶ public
secondsSinceMidnight(): int
Returns the number of whole seconds since midnight.
Returns
intsetHours() ¶ public
setHours(int $hours): static
Set clock hours.
Parameters
-
int$hours Clock hours
Returns
staticsetJsonEncodeFormat() ¶ public static
setJsonEncodeFormat(Closure|string|int $format): void
Sets the default format used when converting this object to JSON
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details)
Alternatively, the format can provide a callback. In this case, the callback can receive this object and return a formatted string.
Parameters
-
Closure|string|int$format Format.
Returns
voidSee Also
setMicroseconds() ¶ public
setMicroseconds(int $microseconds): static
Sets clock microseconds.
Parameters
-
int$microseconds Clock microseconds
Returns
staticsetMinutes() ¶ public
setMinutes(int $minutes): static
Set clock minutes.
Parameters
-
int$minutes Clock minutes
Returns
staticsetSeconds() ¶ public
setSeconds(int $seconds): static
Set clock seconds.
Parameters
-
int$seconds Clock seconds
Returns
staticsetTime() ¶ public
setTime(int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0): static
Sets clock time.
Parameters
-
int$hours optional Clock hours
-
int$minutes optional Clock minutes
-
int$seconds optional Clock seconds
-
int$microseconds optional Clock microseconds
Returns
staticsetToStringFormat() ¶ public static
setToStringFormat(string|int $format): void
Sets the default format used when type converting instances of this type to string
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
Parameters
-
string|int$format Format.
Returns
voidstartOfHour() ¶ public
startOfHour(): static
Resets time to the start of the current hour.
Returns
staticsubHours() ¶ public
subHours(int $value): static
Returns a new instance with the given number of hours subtracted.
Wraps around midnight like {@see self::addHours()}.
Parameters
-
int$value Hours to subtract
Returns
staticsubMinutes() ¶ public
subMinutes(int $value): static
Returns a new instance with the given number of minutes subtracted.
Wraps around midnight like {@see self::addHours()}.
Parameters
-
int$value Minutes to subtract
Returns
staticsubSeconds() ¶ public
subSeconds(int $value): static
Returns a new instance with the given number of seconds subtracted.
Wraps around midnight like {@see self::addHours()}.
Parameters
-
int$value Seconds to subtract
Returns
statictoArray() ¶ public
toArray(): array{hour: int, minute: int, second: int, microsecond: int}
Returns the time as an associative array.
Returns
array{hour: int, minute: int, second: int, microsecond: int}toDateTimeImmutable() ¶ public
toDateTimeImmutable(DateTimeZone|string|null $timezone = null): DateTimeImmutable
Returns an DateTimeImmutable instance set to this clock time.
Parameters
-
DateTimeZone|string|null$timezone optional Time zone the DateTimeImmutable instance will be in
Returns
DateTimeImmutabletoNative() ¶ public
toNative(DateTimeZone|string|null $timezone = null): DateTimeImmutable
Returns an DateTimeImmutable instance set to this clock time.
Alias of toDateTimeImmutable().
Parameters
-
DateTimeZone|string|null$timezone optional Time zone the DateTimeImmutable instance will be in
Returns
DateTimeImmutablewithTicks() ¶ protected
withTicks(int $ticks): static
Returns a clone with the given absolute tick value.
Parameters
-
int$ticks Ticks value
Returns
staticProperty Detail
$formatters ¶ protected static
In-memory cache of date formatters
Type
array<string, \IntlDateFormatter>$jsonEncodeFormat ¶ protected static
The format to use when converting this object to JSON.
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
Type
Closure|string|int$niceFormat ¶ public static
The format to use when formatting a time using Cake\I18n\Time::nice()
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
Type
string|int$toStringFormat ¶ protected static
The format to use when formatting a time using Cake\I18n\Time::i18nFormat()
and __toString.
The format should be either the formatting constants from IntlDateFormatter as described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern as specified in (https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details)
Type
array|string|int