Helper methods to generate locale sensitive output.
| package | XenForo_Core |
|---|
date(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
stringFormat that maps to a known type. Uses default if specified. (Currently ignored.)
arraynullInfo about language to override default
stringnullString time zone to override default
stringdateTime(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string | array
stringFormat that maps to a known type. Uses default if specified.
arraynullInfo about language to override default
stringnullString time zone to override default
stringarrayIf format 'separate' is specified, returns [dateString, date, time]getDayStartTimestamps() : array
array[now => long, today => long, todayDow => long, yesterday => long, week => long]getDefaultTimeZone() : \DateTimeZone | null
\DateTimeZonenull
getFormattedDate(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
stringFormat to display as; compatible with sub-set of date() options
arraynullLanguage (if overriding default)
stringnullTime zone user is in (if overriding default)
stringgetFormattedDateInternal(\DateTime $date, string $format, array $phrases) : string
String-based identifiers (months, days of week) need to be passed in.
stringFormat to display as; supports a subset of the formats from the built-in date() function
arrayList of phrases that will be used to replace string-based identifiers
stringFormatted dategetRelativeDate(\DateTime $date, array $phrases) : string | false
getRelativeDateTime(\DateTime $date, string $timeFormat, array $phrases) : string | false
getTimeZoneOffset() : integer
integernumberFormat(float | integer $number, integer | string $precision, array $language) : string
Also used for file size formatting.
floatintegerNumber to format
integerstringNumber of places to show after decimal point or word "size" for file size
arraynullLanguage to override default
stringFormatted numbersetDefaultLanguage(array $language, string | null $timeZoneString)
array
stringnullString time zone (eg, Europe/London)
setDefaultTimeZone(string $timeZoneString)
stringString time zone (eg, Europe/London);
time(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
stringFormat that maps to a known type. Uses default if specified. (Currently ignored.)
arraynullInfo about language to override default
stringnullString time zone to override default
string_getDateObject(integer | \DateTime | null $timestamp, string | null $timeZoneString) : \DateTime
__construct()
Use this class statically.
$_dateObj : \DateTime | null
This will be set only if setTimestamp exists on it (PHP 5.3 and newer). This serves as an optimization to avoid object creation and date parsing overhead.
$_dayStartTimestamps
$_dowTranslation : array
$_language : array
$_timeZone : \DateTimeZone | null