Class Date
Provides methods useful in formatting dates and date timestamps.
Methods summary
public
|
#
__construct( array $formats = null, mixed $timezone_from = null, mixed $timezone_to = null )
Constructs a new Date component using the given date formats in $formats. |
public
|
#
setTimezone( string $from = null, string $to = null )
Set the current time zone to be used during date calculations |
public
|
|
public
string
|
#
cast( string $date, string $format = "date" )
Format a date using one of the date formats provided to the constructor, or predefined in this class. |
public
string
|
#
dateRange( string $start, string $end, array $formats = null )
Format two dates to represent a range between them. |
public
string
|
|
public
integer
|
|
public
array
|
#
getMonths( integer $start = 1, integer $end = 12, string $key_format = "m", string $value_format = "F" )
Returns an array of months in key/value pairs |
public
array
|
#
getYears( integer $start, integer $end, string $key_format = "y", string $value_format = "Y" )
Returns an array of keys in key/value pairs |
private
|
|
public
array
|
|
private
An
|
#
timezoneFromIdentifier( arary & $zone_info, string $identifier )
Constructs the timezone meta data using the given timezone and its identifier |
private static
|
#
insertionSort( array & $array, string $key )
Insertion sort algorithm for numerically indexed arrays with string indexed elements. Will sort items in $array based on values in the $key index. Sorts arrays in place. |
private static
|
#
insertSortInsert( array & $array, integer $length, array $element, string $key )
Insertion sort in inserter. Performs comparison and insertion for the given element within the given array. |
private
array
|
#
mergeArrays( array $arr1, array $arr2 )
Extends one array using another to overwrite existing values. Recursively merges data. |
Magic methods summary
Constants summary
string |
ATOM |
"Y-m-d\TH:i:sP" |
|
string |
COOKIE |
"l, d-M-y H:i:s T" |
|
string |
ISO8601 |
"Y-m-d\TH:i:sO" |
|
string |
RFC822 |
"D, d M y H:i:s O" |
|
string |
RFC850 |
"l, d-M-y H:i:s T" |
|
string |
RFC1036 |
"D, d M y H:i:s O" |
|
string |
RFC1123 |
"D, d M Y H:i:s O" |
|
string |
RFC2822 |
"D, d M Y H:i:s O" |
|
string |
RFC3339 |
"Y-m-d\TH:i:sP" |
|
string |
RSS |
"D, d M Y H:i:s O" |
|
string |
W3C |
"Y-m-d\TH:i:sP" |
Properties summary
private
array
|
$formats |
#
Common date formats, predefined for PHP's date function, overwritable by the constructor |
private
mixed
|
$timezone_from | |
private
mixed
|
$timezone_to |