GoLang DateTime::getTimezone

request it (374)
GoLang replacement for PHP's DateTime::getTimezone [edit | history]



Do you know a GoLang replacement for PHP's DateTime::getTimezone? Write it!

PHP DateTime::getTimezone

PHP original manual for DateTime::getTimezone [ show | php.net ]

DateTime::getTimezone

DateTimeImmutable::getTimezone

DateTimeInterface::getTimezone

date_timezone_get

(PHP 5 >= 5.2.1 < 5.5.0)

DateTime::getTimezone -- DateTimeImmutable::getTimezone -- DateTimeInterface::getTimezone -- date_timezone_getReturn time zone relative to given DateTime

Description

Object oriented style

public DateTimeZone DateTime::getTimezone ( void )
public DateTimeZone DateTimeImmutable::getTimezone ( void )
public DateTimeZone DateTimeInterface::getTimezone ( void )

Procedural style

Return time zone relative to given DateTime.

Parameters

object

Procedural style only: A DateTime object returned by date_create()

Return Values

Returns a DateTimeZone object on success or FALSE on failure.

Examples

Example #1 DateTime::getTimezone() example

Object oriented style

<?php
$date 
= new DateTime(null, new DateTimeZone('Europe/London'));
$tz $date->getTimezone();
echo 
$tz->getName();
?>

Procedural style

<?php
$date 
date_create(nulltimezone_open('Europe/London'));
$tz date_timezone_get($date);
echo 
timezone_name_get($tz);
?>

The above examples will output:

Europe/London

See Also