Class DateTime
Contains helper methods concerned with date and time manipulation.
Methods summary
public static
array
|
#
getTimezonesList( )
Fetches all available timezone codes.
Fetches all available timezone codes.
Returns
array Timezones with locations and location offsets from GMT.
|
public static
boolean
|
#
setEnvironmentTimezone( string $timezone )
Changes the default PHP time/date functions timezone.
Changes the default PHP time/date functions timezone.
Parameters
- $timezone
- Valid timezone code.
Returns
boolean FALSE if the $timezone isn't valid, or TRUE otherwise.
|
public static
string
|
#
format( string $datetime, string $format = 'Y-m-d H:i:s' )
Format a datetime string to currently set timezone according to given format.
Format a datetime string to currently set timezone according to given format.
Parameters
- $datetime
- String representation of a datetime object.
- $format
- Format of the returned date.
Returns
string Formatted according to the given format using the given Unix timestamp.
|
public static
string
|
#
formatGmt( string $datetime, string $format = 'Y-m-d H:i:s' )
Format a datetime string to UTC/GMT according to given format.
Format a datetime string to UTC/GMT according to given format.
Parameters
- $datetime
- String representation of a datetime object.
- $format
- Format of the returned date.
Returns
string
|