PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
m2babaey
Forum Contributor
Posts: 364 Joined: Sun May 20, 2007 9:26 am
Post
by m2babaey » Wed Aug 15, 2007 7:56 am
Hi
I want to calcaulate how many, days is between 2010-1-10 and 1999-11-1
Ho can i do that?
miro_igov
Forum Contributor
Posts: 485 Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria
Post
by miro_igov » Wed Aug 15, 2007 8:03 am
Code: Select all
$from = strtotime('1999-11-1');
$to = strtotime('2010-1-10');
$seconds = $to - $from;
$days = $seconds / 60*60*24;
echo $days;
This will not work for dates before 1970.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Aug 15, 2007 8:40 am
We've had several topics on this recently. There's also a Code Snippet about this. What results have you found from searching?