Date weirdness

[email protected] (Larry Martell)
Newsgroups php.general
Message-ID <CACwCsY74JsQV0xbfU4gqR3sPdkxGgJ-x02bnv5kzKpaH0WNp+g@mail.gmail.com>
I think I am losing my mind. I have some time zone converting code,
and I just don't understand what I am seeing. Also my system seems to
return the wrong time after I do some date operations on unrelated
objects.

This is from a machine that is in eastern time. I want to convert to,
for example central time:


$ndate = new Date(date("Y-m-d H:i:s"));
echo $ndate->format("%Y-%m-%d %H:%M:%S");
2013-03-28 15:35:07  <- this is the correct time

$ndate->setTZbyID("EDT");
echo $ndate->format("%Y-%m-%d %H:%M:%S");
2013-03-28 15:35:07 <- still correct

$ndate->convertTZbyID("US/Central");
echo $ndate->format("%Y-%m-%d %H:%M:%S");
2013-03-28 10:35:07 <- this is wrong it should be 14:35:07

$xdate = new Date(date("Y-m-d H:i:s"));
echo $xdate->format("%Y-%m-%d %H:%M:%S");
2013-03-28 19:35:07 <- HUH? This is wrong - should be 15:35:07

What in the world is going on here?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.