ICanBoogie
  • Documentation
  • API Reference
  • DateTime 2.0.x
Namespaces
  • ICanBoogie
    • DateTime
Classes
  • DateTimeLocalizer
  • ImmutableDateTime
  • MutableDateTime
  • TimeZone
  • TimeZoneLocation
Interfaces
  • DateTime

Class TimeZone

Representation of a timezone.

<?php

use ICanBoogie\TimeZone;

$zone = new TimeZone('Europe/Paris');

echo $zone;                     // "Europe/Paris"
echo $zone->offset;             // 3600
echo $zone->location;           // FR,48.86667,2.33333
echo $zone->location->latitude; // 48.86667
echo $zone->is_utc;             // false
echo $zone->is_local;           // true
DateTimeZone
┗ ICanBoogie\TimeZone
Namespace: ICanBoogie
Located at TimeZone.php

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

ICanBoogie\TimeZone
public __construct( string $timezone )

Initializes the $name property.

Initializes the $name property.

Parameters

$timezone

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_location( void ) : ICanBoogie\TimeZoneLocation

Returns

ICanBoogie\TimeZoneLocation
protected get_name( void ) : string

Returns

string
protected get_offset( void ) : integer

Returns

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 $location : ICanBoogie\TimeZoneLocation

Location information for the timezone.

public read-only $name : string

Name of the timezone.

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.

DateTime 2.0.x – Check on GitHub – API documentation generated by ApiGen