Date
extends AbstractDate
in package
Date Header
Tags
Table of Contents
Constants
- DATE_ANSIC = 2
- DATE_RFC1036 = 1
- DATE_RFC1123 = 0
- Date formats according to RFC 2616
Properties
- $date : DateTime
- Date instance for this header
- $dateFormat : string
- Date output format
- $dateFormats : array<string|int, mixed>
- Date formats defined by RFC 2616. RFC 1123 date is required RFC 1036 and ANSI C formats are provided for compatibility with old servers/clients
Methods
- __toString() : string
- Allow casting to string
- compareTo() : int
- Compare provided date to date for this header Returns < 0 if date in header is less than $date; > 0 if it's greater, and 0 if they are equal.
- date() : DateTime
- Return date for this header as an instance of \DateTime
- fromString() : static
- Create date-based header from string
- fromTimestamp() : static
- Create date-based header from Unix timestamp
- fromTimeString() : static
- Create date-based header from strtotime()-compatible string
- getDate() : string
- Return date for this header
- getDateFormat() : string
- Return current date output format
- getFieldName() : string
- Get header name
- getFieldValue() : string
- Get header value as formatted date
- setDate() : $this
- Set the date for this header, this can be a string or an instance of \DateTime
- setDateFormat() : mixed
- Set date output format
- toString() : string
- Return header line
Constants
DATE_ANSIC
public
mixed
DATE_ANSIC
= 2
DATE_RFC1036
public
mixed
DATE_RFC1036
= 1
DATE_RFC1123
Date formats according to RFC 2616
public
mixed
DATE_RFC1123
= 0
Tags
Properties
$date
Date instance for this header
protected
DateTime
$date
$dateFormat
Date output format
protected
static string
$dateFormat
= 'D, d M Y H:i:s \G\M\T'
$dateFormats
Date formats defined by RFC 2616. RFC 1123 date is required RFC 1036 and ANSI C formats are provided for compatibility with old servers/clients
protected
static array<string|int, mixed>
$dateFormats
= [self::DATE_RFC1123 => 'D, d M Y H:i:s \G\M\T', self::DATE_RFC1036 => 'D, d M y H:i:s \G\M\T', self::DATE_ANSIC => 'D M j H:i:s Y']
Tags
Methods
__toString()
Allow casting to string
public
__toString() : string
Return values
stringcompareTo()
Compare provided date to date for this header Returns < 0 if date in header is less than $date; > 0 if it's greater, and 0 if they are equal.
public
compareTo(string|DateTime $date) : int
Parameters
- $date : string|DateTime
Tags
Return values
intdate()
Return date for this header as an instance of \DateTime
public
date() : DateTime
Return values
DateTimefromString()
Create date-based header from string
public
static fromString(string $headerLine) : static
Parameters
- $headerLine : string
Tags
Return values
staticfromTimestamp()
Create date-based header from Unix timestamp
public
static fromTimestamp(int $time) : static
Parameters
- $time : int
Tags
Return values
staticfromTimeString()
Create date-based header from strtotime()-compatible string
public
static fromTimeString(int|string $time) : static
Parameters
- $time : int|string
Tags
Return values
staticgetDate()
Return date for this header
public
getDate() : string
Return values
stringgetDateFormat()
Return current date output format
public
static getDateFormat() : string
Return values
stringgetFieldName()
Get header name
public
getFieldName() : string
Return values
stringgetFieldValue()
Get header value as formatted date
public
getFieldValue() : string
Return values
stringsetDate()
Set the date for this header, this can be a string or an instance of \DateTime
public
setDate(string|DateTime $date) : $this
Parameters
- $date : string|DateTime
Tags
Return values
$thissetDateFormat()
Set date output format
public
static setDateFormat(int $format) : mixed
Parameters
- $format : int
Tags
toString()
Return header line
public
toString() : string