Reputation: 1199
I've noticed that one of my scripts that depend on the function date() fell into an infinite loop. While investigating the cause of this, I came up with a very simple an surprising test:
<?php
echo (date("Y-m-d H:i:s",1330221136)."\n\n");
echo (date("Y-m-d H:i:s",1330222036)."\n");
Since the first timestamp is smaller than the second, the first line was supposed to return an earlier datetime. However the out put for the code above is:
2012-02-25 23:52:16
2012-02-25 23:07:16
Does anybody know about any malfunctioning of the function date() in PHP 5.3?
Upvotes: 2
Views: 169
Reputation: 437854
This could legitimately happen if the clocks were turned one hour backwards at exactly 00:00 local time. So:
Upvotes: 6
Reputation: 21866
A copy/paste to my installation gives this as a result:
2012-02-26 02:52:16
2012-02-26 03:07:16
That seems fine to me.
Upvotes: 1