Class TimeZone
Representation of a timezone.
<?php
use ICanBoogie\TimeZone;
$zone = new TimeZone('Europe/Paris');
echo $zone;
echo $zone->offset;
echo $zone->location;
echo $zone->location->latitude;
echo $zone->is_utc;
echo $zone->is_local;
-
DateTimeZone
-
┗
ICanBoogie\TimeZone
Methods summary
public static
from( mixed $source )
: ICanBoogie\TimeZone
Returns a timezone according to the specified source.
Returns a timezone according to the specified source.
If the source is already an instance of Zone, it is returned as is.
Note: Instances created by the method are shared. That is, equivalent sources yield
the same instance.
Parameters
$source
- Source of the timezone.
Returns
public
__construct( string $timezone )
Initializes the $name property.
Initializes the $name property.
Parameters
Overrides
DateTimeZone::__construct
public
__get( $property )
Throws
LogicException
in attempt to get an undefined property.
Inheritdoc
public
__set( $property, $value )
Throws
LogicException
in attempt to write any property.
Inheritdoc
protected
get_name( void )
: string
protected
get_offset( void )
: integer
protected
get_is_utc( void )
: boolean
Returns
boolean
true if time zone is UTC, false otherwise.
protected
get_is_local( void )
: boolean
Returns
boolean
true if time zone is local, false otherwise.
public
__toString( void )
: string
Returns the name of the timezone.
Returns the name of the timezone.
Returns
string
Methods inherited from DateTimeZone
__set_state(),
__wakeup(),
getLocation(),
getName(),
getOffset(),
getTransitions(),
listAbbreviations(),
listIdentifiers()
Constants summary
Constants inherited from DateTimeZone
AFRICA,
ALL,
ALL_WITH_BC,
AMERICA,
ANTARCTICA,
ARCTIC,
ASIA,
ATLANTIC,
AUSTRALIA,
EUROPE,
INDIAN,
PACIFIC,
PER_COUNTRY,
UTC
Properties summary
Magic properties
public read-only
$name
: string
public read-only
$offset
: integer
Timezone offset from UTC.
public read-only
$is_utc
: boolean
true Time zone is UTC, false otherwise.
public read-only
$is_local
: boolean
true if time zone is local, false otherwise.