File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / date / tests / DateTime_getTimeZone_basic1.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:53 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test DateTime::getTimezone() function : basic functionality 
--FILE--
<?php
/* Prototype  : public DateTimeZone DateTime::getTimezone  ( void  )
 * Description: Return time zone relative to given DateTime
 * Source code: ext/date/php_date.c
 * Alias to functions: date_timezone_get
 */

echo "*** Testing DateTime::getTimezone() : basic functionality ***\n";

date_default_timezone_set("Europe/London");
$object = new DateTime("2009-01-30 17:57:32");
var_dump( $object->getTimeZone()->getName() ); 


date_default_timezone_set("America/New_York");
$object = new DateTime("2009-01-30 17:57:32");
var_dump( $object->getTimeZone()->getName() ); 

$la_time = new DateTimeZone("America/Los_Angeles");
$object->setTimeZone($la_time);
var_dump( $object->getTimeZone()->getName() ); 

?>
===DONE===
--EXPECTF--
*** Testing DateTime::getTimezone() : basic functionality ***
string(13) "Europe/London"
string(16) "America/New_York"
string(19) "America/Los_Angeles"
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>