I ran this script:
echo date_default_timezone_get()."
";
echo "----
";
date_default_timezone_set('Asia/Kabul');
echo date_default_timezone_get()."
";
echo "----
";
echo time()."
";
$dt = new DateTime;
echo $dt->format('U') . "
";
echo "----
";
date_default_timezone_set('UTC');
echo date_default_timezone_get()."
";
echo "----
";
echo time()."
";
$dt = new DateTime;
echo $dt->format('U') . "
";
and for all the 4 timestamp values, it says: 1325905766
.
I read somewhere that new DateTime always sets UTC as timezone, whatever the timezone setting, so I get that, but what about time()
?
A few seconds before, on a different server (probably not in Europe (ideone.com)), it returns 4 times: 1325905723
.
That's the same! (A few seconds diff obviously, but the same timezone.)
time()
always and only returns UTC??? What's going on??