Documentation

Date extends DateTimeWizard
in package

Table of Contents

Constants

DAY_NUMBER_LONG  = 'dd'
Day number with a leading zero, e.g. 03.
DAY_NUMBER_SHORT  = 'd'
Day number without a leading zero, e.g. 3.
MONTH_FIRST_LETTER  = 'mmmmm'
MONTH_NAME_FULL  = 'mmmm'
Month name, long form, e.g. January.
MONTH_NAME_SHORT  = 'mmm'
Month name, short form, e.g. Jan.
MONTH_NUMBER_LONG  = 'mm'
Month number with a leading zero if required, e.g. 01.
MONTH_NUMBER_SHORT  = 'm'
Month number without a leading zero, e.g. 1.
SEPARATOR_DASH  = '-'
SEPARATOR_DOT  = '.'
SEPARATOR_SLASH  = '/'
SEPARATOR_SPACE  = ' '
SEPARATOR_SPACE_NONBREAKING  = " "
WEEKDAY_NAME_LONG  = 'dddd'
Day of the week, full form, e.g. Tuesday.
WEEKDAY_NAME_SHORT  = 'ddd'
Day of the week, short form, e.g. Tue.
YEAR_FULL  = 'yyyy'
Year (4 digits), e.g. 2023.
YEAR_SHORT  = 'yy'
Year (last 2 digits), e.g. 23.
DATE_BLOCKS  = [self::YEAR_FULL, self::YEAR_SHORT, self::MONTH_FIRST_LETTER, self::MONTH_NAME_FULL, self::MONTH_NAME_SHORT, self::MONTH_NUMBER_LONG, self::MONTH_NUMBER_SHORT, self::WEEKDAY_NAME_LONG, self::WEEKDAY_NAME_SHORT, self::DAY_NUMBER_LONG, self::DAY_NUMBER_SHORT]
DATE_DEFAULT  = [self::YEAR_FULL, self::MONTH_NUMBER_LONG, self::DAY_NUMBER_LONG]
NO_ESCAPING_NEEDED  = "\$+-/():!^&'~{}<>= "

Properties

$formatBlocks  : array<string|int, string>
$separators  : array<string|int, string>

Methods

__construct()  : mixed
__toString()  : string
format()  : string
escapeSingleCharacter()  : string
intersperse()  : string
padSeparatorArray()  : array<string|int, mixed>
wrapLiteral()  : string
mapFormatBlocks()  : string

Constants

DAY_NUMBER_LONG

Day number with a leading zero, e.g. 03.

public mixed DAY_NUMBER_LONG = 'dd'

DAY_NUMBER_SHORT

Day number without a leading zero, e.g. 3.

public mixed DAY_NUMBER_SHORT = 'd'

MONTH_FIRST_LETTER

public mixed MONTH_FIRST_LETTER = 'mmmmm'

MONTH_NAME_FULL

Month name, long form, e.g. January.

public mixed MONTH_NAME_FULL = 'mmmm'

MONTH_NAME_SHORT

Month name, short form, e.g. Jan.

public mixed MONTH_NAME_SHORT = 'mmm'

MONTH_NUMBER_LONG

Month number with a leading zero if required, e.g. 01.

public mixed MONTH_NUMBER_LONG = 'mm'

MONTH_NUMBER_SHORT

Month number without a leading zero, e.g. 1.

public mixed MONTH_NUMBER_SHORT = 'm'

SEPARATOR_DASH

public mixed SEPARATOR_DASH = '-'

SEPARATOR_DOT

public mixed SEPARATOR_DOT = '.'

SEPARATOR_SLASH

public mixed SEPARATOR_SLASH = '/'

SEPARATOR_SPACE

public mixed SEPARATOR_SPACE = ' '

SEPARATOR_SPACE_NONBREAKING

public mixed SEPARATOR_SPACE_NONBREAKING = " "

WEEKDAY_NAME_LONG

Day of the week, full form, e.g. Tuesday.

public mixed WEEKDAY_NAME_LONG = 'dddd'

WEEKDAY_NAME_SHORT

Day of the week, short form, e.g. Tue.

public mixed WEEKDAY_NAME_SHORT = 'ddd'

YEAR_FULL

Year (4 digits), e.g. 2023.

public mixed YEAR_FULL = 'yyyy'

YEAR_SHORT

Year (last 2 digits), e.g. 23.

public mixed YEAR_SHORT = 'yy'

DATE_BLOCKS

protected mixed DATE_BLOCKS = [self::YEAR_FULL, self::YEAR_SHORT, self::MONTH_FIRST_LETTER, self::MONTH_NAME_FULL, self::MONTH_NAME_SHORT, self::MONTH_NUMBER_LONG, self::MONTH_NUMBER_SHORT, self::WEEKDAY_NAME_LONG, self::WEEKDAY_NAME_SHORT, self::DAY_NUMBER_LONG, self::DAY_NUMBER_SHORT]

DATE_DEFAULT

protected mixed DATE_DEFAULT = [self::YEAR_FULL, self::MONTH_NUMBER_LONG, self::DAY_NUMBER_LONG]

NO_ESCAPING_NEEDED

protected mixed NO_ESCAPING_NEEDED = "\$+-/():!^&'~{}<>= "

Properties

$formatBlocks

protected array<string|int, string> $formatBlocks

$separators

protected array<string|int, string> $separators

Methods

__construct()

public __construct([null|string|array<string|int, string> $separators = self::SEPARATOR_DASH ], string ...$formatBlocks) : mixed
Parameters
$separators : null|string|array<string|int, string> = self::SEPARATOR_DASH

If you want to use the same separator for all format blocks, then it can be passed as a string literal; if you wish to use different separators, then they should be passed as an array. If you want to use only a single format block, then pass a null as the separator argument

$formatBlocks : string

format()

public format() : string
Return values
string

escapeSingleCharacter()

protected escapeSingleCharacter(string $value) : string
Parameters
$value : string
Return values
string

intersperse()

protected intersperse(string $formatBlock, string|null $separator) : string
Parameters
$formatBlock : string
$separator : string|null
Return values
string

padSeparatorArray()

protected padSeparatorArray(array<string|int, mixed> $separators, int $count) : array<string|int, mixed>
Parameters
$separators : array<string|int, mixed>
$count : int
Return values
array<string|int, mixed>

wrapLiteral()

protected wrapLiteral(string $value) : string
Parameters
$value : string
Return values
string

mapFormatBlocks()

private mapFormatBlocks(string $value) : string
Parameters
$value : string
Return values
string

        
On this page

Search results