Civil Date PHP Package

TwoDigitYear
in package
implements ParsableTokenRule

Formats and parses two-digit year token values.

Table of Contents

Interfaces

ParsableTokenRule
Defines parsing behavior for a date-pattern token.

Methods

captureRegex()  : string
Returns the regular-expression fragment for capturing this token.
format()  : string
Formats the year as two localized digits.
parse()  : int
Parses and expands a two-digit year.
property()  : string
Returns the semantic calendar-date property represented by this rule.

Methods

captureRegex()

Returns the regular-expression fragment for capturing this token.

public captureRegex() : string
Return values
string

Capturing regular-expression fragment.

format()

Formats the year as two localized digits.

public format(CalendarDate $date, Locale $locale) : string
Parameters
$date : CalendarDate

Date providing the year.

$locale : Locale

Locale definition.

Return values
string

Formatted year.

parse()

Parses and expands a two-digit year.

public parse(string $value, Calendar $calendar, Locale $locale) : int
Parameters
$value : string

Captured input value.

$calendar : Calendar

Calendar associated with the token scope.

$locale : Locale

Locale definition.

Tags
throws
DateParseException

If the captured value is invalid or outside 00..99.

Return values
int

Expanded year.

property()

Returns the semantic calendar-date property represented by this rule.

public property() : string
Return values
string

Calendar-date property name.

On this page

Search results