note 77217 added to function.timezone-open
| From: | mcmohd at gmail dot com | Date: | Mon, 20 Aug 2007 17:03:21 +0000 |
| Subject: | note 77217 added to function.timezone-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129645@lists.php.net to get a copy of this message | ||
Following is the example on using both the above functions:
<?php
$dateSrc = '2007-04-19 12:50 GMT';
$dateTime = date_create( $dateSrc);
$DateTimeZone = timezone_open ( 'America/Chicago' );
date_timezone_set( $dateTime, $DateTimeZone );
$NewDateTimeZone = date_timezone_get($dateTime);
echo 'New timeZone is '. timezone_name_get($NewDateTimeZone);
echo "\n";
# Using second function.
$dateTime = new DateTime($dateSrc);
$DateTimeZone = new DateTimeZone( 'America/Chicago' );
$dateTime->setTimezone( $DateTimeZone );
$NewDateTimeZone = $dateTime->getTimezone ();
echo 'New timeZone is '. timezone_name_get ($NewDateTimeZone);
?>
This will produce following result: ( May be different on your computer )
New timeZone is America/Chicago
New timeZone is America/Chicago
Thanks
http://www.tutorialspoint.com/php
----
Server IP: 203.16.234.19
Probable Submitter: 122.169.146.133
----
Manual Page -- http://www.php.net/manual/en/function.timezone-open.php
Edit -- https://master.php.net/note/edit/77217
Del: integrated -- https://master.php.net/note/delete/77217/integrated
Del: useless -- https://master.php.net/note/delete/77217/useless
Del: bad code -- https://master.php.net/note/delete/77217/bad+code
Del: spam -- https://master.php.net/note/delete/77217/spam
Del: non-english -- https://master.php.net/note/delete/77217/non-english
Del: in docs -- https://master.php.net/note/delete/77217/in+docs
Del: other reasons-- https://master.php.net/note/delete/77217
Reject -- https://master.php.net/note/reject/77217
Search -- https://master.php.net/manage/user-notes.php