You are here: Re: difference from dates « PHP Programming Language « IT news, forums, messages
Re: difference from dates

Posted by Toby A Inkster on 03/06/07 10:38

Davide wrote:

> I need to build a script wich can calulate the difference from a
> specific date "2007-03-01" to current date.

$old_date = strtotime('2007-03-01');
$now_date = time();
$date_diff = $now_date - $old_date;
printf( "Date difference is %.2f seconds (%.2f days).\n",
$date_diff,
$date_diff/(24*60*60) );

See also:
http://www.php.net/manual/en/function.strtotime.php

--
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!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация