and like us on FB

Most social networks provide a historical timestamp to read as a human-readable string – such as 1 day ago, 3 weeks ago, 1 year, 5 months, and so on. The same application applies to future events or posts. The purpose of the string is to provide a general frame of time-reference and thus negating the need for any mental acrobatics. WordPress provides a default function called human_time_diff() that accomplishes this from within WordPress. It’s this function we’ve slightly modified for use in other PHP applications (outside of WP).

PHP Code

Examples

Returns: 44 years ago.

Returns: 6 months.

Considerations

Download

Title: Human Readable Time Difference With PHP
Description: Human Readable Time Difference With PHP. A modified version of WP's human_time_diff function.
Download: PHP Code (V0.2) | Plugin Page

Shortt URL for this post: http://shor.tt/2GSi