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

Otto otto at ottodestruct.com
Thu Mar 26 07:24:22 GMT 2009

The function "get_the_time" will get the time for the current post.
Are you putting this code in the correct place in the Loop?

Sent from: Memphis Tennessee United States.

On Tue, Mar 24, 2009 at 6:04 PM, Chetan Kunte <ckunte at gmail.com> wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list