Overview

Namespaces

  • pgn
    • exceptions
    • tags
  • utils

Classes

  • Annotator
  • Black
  • BlackElo
  • BlackNA
  • BlackTitle
  • BlackType
  • BlackUSCF
  • Board
  • Date
  • ECO
  • Event
  • EventCountry
  • EventDate
  • EventRounds
  • EventSponsor
  • EventType
  • FEN
  • Mode
  • NIC
  • Opening
  • PlyCount
  • Result
  • Round
  • Section
  • SetUp
  • Site
  • Source
  • SourceDate
  • Stage
  • SubVariation
  • Tag
  • Termination
  • Time
  • TimeControl
  • UknownTag
  • UTCDate
  • UTCTime
  • Variation
  • White
  • WhiteElo
  • WhiteNA
  • WhiteTitle
  • WhiteType
  • WhiteUSCF
  • Overview
  • Namespace
  • Class

Class Date

Description of Date: The Date tag value gives the starting date for the game. (Note: this is not necessarily the same as the starting date for the event.) The date is given with respect to the local time of the site given in the Event tag. The Date tag value field always uses a standard ten character format: "YYYY.MM.DD". The first four characters are digits that give the year, the next character is a period, the next two characters are digits that give the month, the next character is a period, and the final two characters are digits that give the day of the month. If the any of the digit fields are not known, then question marks are used in place of the digits.

pgn\tags\Tag
Extended by pgn\tags\Date

Direct known subclasses

pgn\tags\EventDate, pgn\tags\SourceDate, pgn\tags\UTCDate
Namespace: pgn\tags
Author: Geraldo
See: pgn_standard.txt
Located at pgn/tags/Date.php
Methods summary
public boolean
# validate( DateTime $date )

Parameters

$date

Returns

boolean
returns true if data is a valid Date

Assert

("????.??.??") === true Convention: year zero is valid:


("0000.??.??") === true
("????.??.4?") === false
("9999.?9.31") === false
("9999.?9.30") === true
("????.2?.??") === false
("????.1?.??") === true
("????.0?.??") === true
("????.03.??") === true
("????.02.??") === true
("0001.02.?1") === true
("????.02.3?") === false
("????.02.1?") === true
("????.02.2?") === true
("????.02.29") === true
("1992.08.31") === true
("2015.11.2?") === true
("2015.11.??") === true
("2015.1?.??") === true
("2015.??.??") === true
("201?.??.??") === true
("20??.??.??") === true
("2???.??.??") === true
(new \DateTime) === true
("1992.0?.??") === true
("1992.02.3?") === false
("1992.4?.??") === false
("1992.1?.??") === true
("1992.31.08") === false
("08.31.1992") === false
("08/31/1992") === false
("1992/08/31") === false
(null) === false
(new \stdClass) === false
(array (1988,11,02)) === false

("aabb.vv.aa") === false Testes relacionados a anos bissextos


("??11.02.29") === false
("??12.02.29") === true
("??14.02.29") === false
("??16.02.29") === true
("??18.02.29") === false
("??20.02.29") === true
("??22.02.29") === false
("??24.02.29") === true
("??26.02.29") === false
("??28.02.29") === true
("2015.02.29") === false

Overrides

pgn\tags\Tag::validate()
public string
# getDefaultValue( )

Returns

string
Default Date Value

Assert

() == "????.??.??"

Overrides

pgn\tags\Tag::getDefaultValue()
public string
# getName( )

Returns

string
the name of the tag

Assert

() == "Date"
protected string
# formatted( DateTime|string $data )

Parameters

$data

Returns

string

Assert

(null) === '????.??.??'
("1988.02.11") === '1988.02.11'
(\DateTime::createFromFormat('d/m/Y', '02/11/1988')) === '1988.11.02'

Overrides

pgn\tags\Tag::formatted()
protected string
# yearReplaceDefaults( string $year )

WARNING: this method takes on $year having only numbers or question marks

WARNING: this method takes on $year having only numbers or question marks

Parameters

$year

Returns

string
the year with question marks replaced by default values

Assert

("????") === '1124'
("19??") === '1924'
("1???") === '1124'
("2???") === '2124'
("?0??") === '1024'
("20?6") === '2016'
("20?4") === '2024'
("198?") === '1984'
("??11") === '1111'
("??12") === '1112'
("??14") === '1114'
("??16") === '1116'
("??18") === '1118'
("??20") === '1120'
("??22") === '1122'
("??24") === '1124'
("??26") === '1126'
("??28") === '1128'
("0000") === '0000'
protected string
# monthReplaceDefaults( string $monthPartial )

Parameters

$monthPartial
with two characters

Returns

string

Assert

('??') === '11'
('?0') === '10'
('?2') === '12'
('?3') === '03'
('?9') === '09'
protected boolean
# isBissextile( string $year )

WARNING: this method takes on $year having only numbers or question marks

WARNING: this method takes on $year having only numbers or question marks

Parameters

$year

Returns

boolean
true if a given year is bissextile

Assert

("2015") === false
("2014") === false
("0004") === true
("0008") === true
("1000") === false
("2000") === true
("2016") === true
("2012") === true
public static string
# validPattern( )

Returns

string
Valid Regular Expression Pattern for PGN Dates

Overrides

pgn\tags\Tag::validPattern()
Methods inherited from pgn\tags\Tag
__toString(), createTag(), get(), parse(), parseTagName(), parseTagValue(), set()
Properties inherited from pgn\tags\Tag
$data, $errorMsg
API documentation generated by ApiGen