By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

Why is date("r") sometimes in +0100 and sometimes in +0200?

P: n/a
Hey everyone, this is my first messege to this group, so I hope it's
fitting.

I've been messing with time alot recently, particularly time
formatting. During that, I've observed, that when getting a date in
RFC 822 format (like: Thu, 21 Dec 2000 16:01:07 +0200), sometimes, the
timezone offset will differ.

Sometimes, PHP will use +0100 and othertimes, +0200. I've also fed the
unix timestamp, from which php generated the date, into a similar
JavaScript of mine. Here, I can also see, that the timezone offset
differs. Sometimes, it's +0200, othertimes, +0100.

While I know it doesn't make a difference, time elapsed wise, it kinda
strikes me as strange. I'm personally in +0200 (CET with summer time),
while the server should also be in +0200 (but it might be in something
else, it's not mine, but I know it's here in the country).

Here is a randomly generated date list:
http://temp.svendtofte.com/php_rfc_dates_gmt_offset.php

And here's the code:
<pre><?php
function getStamp() {
$higest = time();
return mt_rand(0,$higest);
}

for ($i = 0; $i < 100; $i++) {
$d = getStamp();
echo date("r",$d)."<br>";
}
?></pre>

(if it's ugly, don't yell, I never write PHP)

So, any ideas why? Just...flimsy computers?

Regards,
Svend
Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.