date()
dateTime()
getDayStartTimestamps()
getDefaultTimeZone()
getFormattedDate()
getFormattedDateInternal()
getRelativeDate()
getRelativeDateTime()
getTimeZoneOffset()
numberFormat()
setDefaultLanguage()
setDefaultTimeZone()
time()
_getDateObject()
__construct()
$_dateObj
$_dayStartTimestamps
$_dowTranslation
$_language
$_timeZone
Helper methods to generate locale sensitive output.
package | XenForo_Core |
---|
date(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
string
Format that maps to a known type. Uses default if specified. (Currently ignored.)
array
null
Info about language to override default
string
null
String time zone to override default
string
dateTime(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string | array
string
Format that maps to a known type. Uses default if specified.
array
null
Info about language to override default
string
null
String time zone to override default
string
array
If format 'separate' is specified, returns [dateString, date, time]getDayStartTimestamps() : array
array
[now => long, today => long, todayDow => long, yesterday => long, week => long]getFormattedDate(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
string
Format to display as; compatible with sub-set of date() options
array
null
Language (if overriding default)
string
null
Time zone user is in (if overriding default)
string
getFormattedDateInternal(\DateTime $date, string $format, array $phrases) : string
String-based identifiers (months, days of week) need to be passed in.
string
Format to display as; supports a subset of the formats from the built-in date() function
array
List of phrases that will be used to replace string-based identifiers
string
Formatted dategetRelativeDate(\DateTime $date, array $phrases) : string | false
getRelativeDateTime(\DateTime $date, string $timeFormat, array $phrases) : string | false
getTimeZoneOffset() : integer
integer
numberFormat(float | integer $number, integer | string $precision, array $language) : string
Also used for file size formatting.
float
integer
Number to format
integer
string
Number of places to show after decimal point or word "size" for file size
array
null
Language to override default
string
Formatted numbersetDefaultLanguage(array $language, string | null $timeZoneString)
array
string
null
String time zone (eg, Europe/London)
setDefaultTimeZone(string $timeZoneString)
string
String time zone (eg, Europe/London);
time(integer | \DateTime $timestamp, string $format, array $language, string | null $timeZoneString) : string
string
Format that maps to a known type. Uses default if specified. (Currently ignored.)
array
null
Info about language to override default
string
null
String 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