DateTimeFormatter
in package
Format a date/datetime string according to locale
Tags
Table of Contents
- ADD_DATE = 2
- ADD_TIME = 4
- ADD_TIMEZONE = 8
- SHORT = 1
- if set: short, otherwise long
- $_format : int
- $_formatCombinations : array<string|int, mixed>
- $_timestamp : int
- formatByTimestamp() : string
- format() : string
Constants
ADD_DATE
public
mixed
ADD_DATE
= 2
ADD_TIME
public
mixed
ADD_TIME
= 4
ADD_TIMEZONE
public
mixed
ADD_TIMEZONE
= 8
SHORT
if set: short, otherwise long
public
mixed
SHORT
= 1
Properties
$_format
private
int
$_format
= 0
bitmask
$_formatCombinations
private
array<string|int, mixed>
$_formatCombinations
= [self::SHORT | self::ADD_DATE | self::ADD_TIME => 'Y/m/d g:i:s a', self::SHORT | self::ADD_DATE => 'Y/m/d', self::SHORT | self::ADD_TIME => 'g:i:s a']
$_timestamp
private
int
$_timestamp
= 0
Methods
formatByTimestamp()
public
formatByTimestamp(int $format, int $timestamp) : string
Parameters
- $format : int
-
bitmask
- $timestamp : int
-
GMT
Tags
Return values
string —format()
private
format() : string