Welcome Guest, Not a member yet? Register   Sign In
Time difference craziness
#1

[eluser]stuffradio[/eluser]
Some reason, when the time difference gets into the hours... it sometimes shows all the time differences as 354940.6 hours ago hours, etc. Here's the code I'm using:

Code:
$time = (time() - $rss->updated) / 60;
$hours = round($time / 60, 1);

$time is used for minutes, and $hours is the hours. $rss->updated is just a timestamp from the time it was inserted into the db. So why do I get these crazy hour differences sometimes?
#2

[eluser]LuckyFella73[/eluser]
The error must be anywhere else. I tried your
code and did some hardcoding (for emulation $rss->updated) and
I got a right value.

I would check if the timestamp from db is correct. All in all
it's strange anyway if your result is the same everytime you
render the page ...
#3

[eluser]stuffradio[/eluser]
It only happens sometimes. Like I said, the minutes time work perfectly all the time... it's only the hours one.




Theme © iAndrew 2016 - Forum software by © MyBB