Welcome Guest, Not a member yet? Register   Sign In
local to gmt function doesn't work
#4

(This post was last modified: 07-11-2017, 07:02 PM by skunkbad.)

More than one way to skin a cat:

PHP Code:
<?php
$date 
= new DateTime('now', new DateTimeZone('Europe/Berlin'));

$tz $date->getTimezone();

echo 
$date->format('Y-m-d H:i:s') . " in " $tz->getName() . "<br />";

$date->setTimezone(new DateTimeZone('Asia/Singapore'));

$tz $date->getTimezone();

echo 
$date->format('Y-m-d H:i:s') . " in " $tz->getName() . "<br />";

$date->setTimezone(new DateTimeZone('UTC'));

$tz $date->getTimezone();

echo 
$date->format('Y-m-d H:i:s') . " in " $tz->getName() . "<br />";

$date->setTimezone(new DateTimeZone('America/Los_Angeles'));

$tz $date->getTimezone();

echo 
$date->format('Y-m-d H:i:s') . " in " $tz->getName() . "<br />"
DateTime class > CI date helper
Reply


Messages In This Thread
local to gmt function doesn't work - by ardavan - 07-11-2017, 06:41 AM
RE: local to gmt function doesn't work - by skunkbad - 07-11-2017, 06:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB