Display human friendly relative dates and times 0.9

Free PHP script: Display human friendly relative dates and times is one of the really lovely features that social sites like Twitter and Facebook give to users is a nice friendly way of displaying relative dates and times.

For example:
"1 hour ago"
"Next Tuesday"
"Next month"
This PHP script converts an SQL date into a human friendly string representing that date and time relative to now.

The Code:
The code for using this script is really simple. Just include the script, instantiate the object, and pass it an SQL date:
require_once('humanRelativeDate.class.php');
$humanRelativeDate = new HumanRelativeDate();
$string = $humanRelativeDate->getTextForSQLDate($sql_date);
What could be easier?

Daylight Saving:
Please note that this script uses 86400 seconds as its basis for events less than 2 days away, and therefore does not correctly account for daylight saving days, where the day can be either 82800 in case its the winter change or 90000 for the summer change.

As a result, when viewing this script on a DST day, some unexpected results may occur: for example, an event which occurs on midnight the day after may be labelled as occuring "in two days", rather than "tomorrow". We may address this in a future version.

Legalese:
Whilst we've made every effort to make this script both bomb and idiot proof, the usual disclaimers apply: Invent Partners accepts no liability for any loss or damages incurred by the use or misuse of this script. Sorry.

License type: GNU General Public License
Date added: 4 years, 2 months 13 days ago | Last updated: 3 years, 8 months 25 days ago

More popular Date & Time

This is actually one of the most advanced image hosting script. The imagetize key features: SEO, Ads Ready, Admin

Listing Files

friendly_date
__MACOSX
friendly_date
Hot Scripts
Sponsors