I ran this script:
echo date_default_timezone_get()."\n";
echo "----\n";
date_default_timezone_set('Asia/Kabul');
echo date_default_timezone_get()."\n";
echo "----\n";
echo time()."\n";
$dt = new DateTime;
echo $dt->format('U') . "\n";
echo "----\n";
date_default_timezone_set('UTC');
echo date_default_timezone_get()."\n";
echo "----\n";
echo time()."\n";
$dt = new DateTime;
echo $dt->format('U') . "\n";
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??
date()function was the timezone identifier at the end. It wasn't actually changing the time itself. - animuson