Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- difference from dates
March 5, 2007, 1:49 pm
rate this thread
I'm looking in php.net a function that helps me to work with date.
I need to build a script wich can calulate the difference from a
specific date "2007-03-01" to current date.
I'm thinking about unix epoch, is it the correct way?
2007-03-05 - 2007-03-01 = 2 days
2007-03-05 - 2007-02-05 = 1 month
Re: difference from dates
$old_date = strtotime('2007-03-01');
$now_date = time();
$date_diff = $now_date - $old_date;
printf( "Date difference is %.2f seconds (%.2f days).\n",
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!