TimeZone
in package
Table of Contents
Properties
- $timezone : string
- Default Timezone used for date/time conversions.
Methods
- getTimeZone() : string
- Return the Default Timezone used for date/time conversions.
- getTimeZoneAdjustment() : int
- Return the Timezone offset used for date/time conversions to/from UST This requires both the timezone and the calculated date/time to allow for local DST.
- setTimeZone() : bool
- Set the Default Timezone used for date/time conversions.
- validateTimeZone() : bool
- Validate a Timezone name.
Properties
$timezone
Default Timezone used for date/time conversions.
protected
static string
$timezone
= 'UTC'
Methods
getTimeZone()
Return the Default Timezone used for date/time conversions.
public
static getTimeZone() : string
Return values
string —Timezone (e.g. 'Europe/London')
getTimeZoneAdjustment()
Return the Timezone offset used for date/time conversions to/from UST This requires both the timezone and the calculated date/time to allow for local DST.
public
static getTimeZoneAdjustment(string|null $timezoneName, float|int $timestamp) : int
Parameters
- $timezoneName : string|null
-
The timezone for finding the adjustment to UST
- $timestamp : float|int
-
PHP date/time value
Return values
int —Number of seconds for timezone adjustment
setTimeZone()
Set the Default Timezone used for date/time conversions.
public
static setTimeZone(string $timezoneName) : bool
Parameters
- $timezoneName : string
-
Time zone (e.g. 'Europe/London')
Return values
bool —Success or failure
validateTimeZone()
Validate a Timezone name.
private
static validateTimeZone(string $timezoneName) : bool
Parameters
- $timezoneName : string
-
Time zone (e.g. 'Europe/London')
Return values
bool —Success or failure