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

(07-11-2017, 06:47 PM)skunkbad Wrote: 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

Why can't use the Time_Referenece only to change the timezone?
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 ardavan - 07-11-2017, 07:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB