Hello all, I have a question for ya, I have created a class to change time zones, using Pear's Date.php
Here is my class:
so I create another page to try the methods
and here is my output:
OK, the first one is correct that is GMT time.
The 2nd one is correct for Pacific/Fakaofo.
The 3rd is incorrect, it should be -04 from the first one, GMT and the correct time should be
I am not sure why the method is not returning to GMT to do the conversion. Any ideas?
Thanks,
Timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
So there you go! You're the retarded offspring of five monkeys having butt sex with a fish-squirrel! Congratulations!
Here is my class:
Code:
class DateClass{
function GMT()
{
$nowGMT = date('U') . "<br/>";
$ets = strftime($nowGMT); // this is GMT
$ESTFull = date('Y-m-d H:i:s',$ets);
require_once 'Date.php';
$now = new Date($ESTFull);
// I have to set $now to the correct time zone
// America/Detroit
$now ->setTZByID("America/Detroit");
$timezone = new Date_TimeZone('Etc/Greenwich');
$now->convertTZ($timezone);
return $now->getDate();
}
function TZ($timeZone)
{
$nowGMT = date('U') . "<br/>";
$ets = strftime($nowGMT); // this is GMT
$ESTFull = date('Y-m-d H:i:s',$ets);
require_once 'Date.php';
$now = new Date($ESTFull);
// I have to set $now to the correct time zone
// America/Detroit
$now ->setTZByID("America/Detroit");
$timezone = new Date_TimeZone($timeZone);
$now->convertTZ($timezone);
return $now->getDate();
}
}
so I create another page to try the methods
Code:
require('DateClass.php');
$nd = new DateClass;
echo '<br/>';
echo $nd->GMT();
echo '<br/>';
echo $nd->TZ('Pacific/Fakaofo');
echo '<br/>';
echo $nd->TZ('America/Detroit');
and here is my output:
Code:
2008-09-11 14:47:36
2008-09-11 08:47:36
2008-09-11 04:47:36
The 2nd one is correct for Pacific/Fakaofo.
The 3rd is incorrect, it should be -04 from the first one, GMT and the correct time should be
Code:
2008-09-11 10:47:36
Thanks,
Timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
So there you go! You're the retarded offspring of five monkeys having butt sex with a fish-squirrel! Congratulations!