[wp-hackers] Possible bug in the function human_time_diff()

Chetan Kunte ckunte at gmail.com
Tue Mar 24 23:04:11 GMT 2009

Hi -

I think I am seeing a weird behaviour when I use human_time_diff()
function to show time, using the Codex example as below:

<?php echo human_time_diff(get_the_time('U'),
current_time('timestamp')) . ' ago'; ?>

A couple of minutes after publishing a post, the time stamp was
showing the time in *hours* ago. And it was like 5 hours ago---perhaps
the difference between my current location and my site server. With
every passing hour, it counts down, and at some point, I think when it
crosses the abs time points, it begins to count up again.

At say 5 minutes after local publish time, it looks like '5 hours ago'.
At say 1hr 2 minutes after local publish time, it looks like '4 hours ago'
and so on.
At some point, the count begins upward again.

Also, I never saw the time in minutes.

Could somebody tell me if this is indeed a bug in the function, or am
I using the Codex example of human_time_diff wrong? FWIW, the time in
the Admin area (Edit Posts) appears to show it correctly (in human
readable time).
Chetan, ckunte.com

More information about the wp-hackers mailing list