<?php
/* - - - - - - - - - - - - - - - - -
Object oriented style
- - - - - - - - - - - - - - - - - */
public DateTimeZone::__construct ( str $timezone )
$timezone = The supported timezone name or an offset value
?>
<?php
/* - - - - - - - - - - - - - - - - -
Procedural style
- - - - - - - - - - - - - - - - - */
DateTimeZone|false timezone_open ( str $timezone )
where,
$timezone = The supported timezone name or an offset value
?>
<?php
$tzns01 = [ "America/Sao_Paulo", "Europe/Lisbon", "Asia/Tokyo", "Africa/Foo" ];
foreach($tzns01 as $tz)
{
@var_dump(timezone_open($tz));
echo '<br><br>';
}
?>
<?php
$tzns02 = [ '-0300', '+0200', '+0900', '+0000' ];
foreach($tzns02 as $tz)
{
@var_dump(timezone_open($tz));
echo '<br><br>';
}
?>
<?php
$tzns03 = [ "America/Sao_Paulo",
"Europe/Lisbon",
"Asia/Tokyo",
"Africa/Foo" ];
foreach ($tzns03 as $tz) {
try {
$foo03 = new DateTimeZone($tz);
} catch(Exception $e) {
echo $e->getMessage() . '<br>';
}
}
?>
<?php
$tzns04 = [ '-0300', '+0400', '+0900', '+0000' ];
foreach($tzns04 as $tz)
{
$tzo04 = (array)(timezone_open($tz));
foreach($tzo04 as $ktz04 => $vtz04)
{
echo $ktz04 . ' = ' . $vtz04 . '<br>';
}
echo '<br><br>';
}
// see the next exercise
?>
<?php
$tzns04 = [ '-0300', '+0400', '+0900', '+0000' ];
foreach($tzns04 as $tz)
{
$gt04 = gettimeofday(false);
foreach($gt04 as $kgt04 => $vgt04)
{
echo $kgt04 . ' = ' . $vgt04 . '<br>';
}
echo '<br><br>';
}
?>