note 92749 added to function.date-timezone-set
| From: | fl4sh dot b0y at live dot fr | Date: | Fri, 07 Aug 2009 09:11:22 +0000 |
| Subject: | note 92749 added to function.date-timezone-set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159177@lists.php.net to get a copy of this message | ||
Return Value
Returns NULL on success or FALSE on failure.
Example
Following is the usage of this function:
<?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 = timezone_open ( 'America/Chicago' );
$dateTime->setTimezone( $DateTimeZone );
$NewDateTimeZone = $dateTime->getTimezone ();
echo 'New timeZone is '. timezone_name_get ($NewDateTimeZone);
?>
This will produce following result:
New timeZone is America/Chicago
New timeZone is America/Chicago
----
Server IP: 64.71.164.2
Probable Submitter: 81.49.191.44
----
Manual Page -- http://www.php.net/manual/en/function.date-timezone-set.php
Edit -- https://master.php.net/note/edit/92749
Del: integrated -- https://master.php.net/note/delete/92749/integrated
Del: useless -- https://master.php.net/note/delete/92749/useless
Del: bad code -- https://master.php.net/note/delete/92749/bad+code
Del: spam -- https://master.php.net/note/delete/92749/spam
Del: non-english -- https://master.php.net/note/delete/92749/non-english
Del: in docs -- https://master.php.net/note/delete/92749/in+docs
Del: other reasons-- https://master.php.net/note/delete/92749
Reject -- https://master.php.net/note/reject/92749
Search -- https://master.php.net/manage/user-notes.php