News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Photogapple.co.uk:
time_since
April 20, 2007 @ 11:07:00

On the Photogapple.co.uk blog today, there's some handy code that can definitely be useful when working with dates in PHP - a function to find the difference between the current time and a timestamp you give it.

I found it incredibly difficult to find any form of time_since function in php so to save anyone else the trouble to hunting through hundreds of useless websites here is the function you may want to use, written by Natalie Downe (you don't want to know how long it took to hunt it down).

The function takes in the value, subtracts the two timestamps and loops through an array of "time chunks" to each other to show nicely formatted output of how long the difference it.

0 comments voice your opinion now!
timesince date timestamp compare difference format output timesince date timestamp compare difference format output


blog comments powered by Disqus

Similar Posts

Builder.com.au: Get the correct time by converting between time zones with PHP and PEAR

Kore Nordmann's Blog: Comparision of PHP image libraries

TotalPHP.com: Creating a text or csv file of information from your database

Derick Rethans' Blog: Calculating start and end dates of a week

PHPClasses.org: Lately in PHP, Episode 36 - PHP 5.5 Release Date Imminent


Community Events

Don't see your event here?
Let us know!


interview xdebug extension php7 voicesoftheelephpant introduction podcast symfony2 laravel series community conference framework api example opinion release library performance version

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework