Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting the difference between two dates?

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
I'm pulling two dates from a database. I figured there might already exist a function that can tell me the number of days between the two. Does such a function exist? If not, what do you think the quickest way to implement such a function be? Liam Morley
lmorley@gdc.wpi.edu
"light the deep, and bring silence to the world.
light the world, and bring depth to the silence."
 
try this
$date1 = "2002-09-18" ;
$date2 = "2002-09-25" ;

$date1=strtotime("$date1 00:00");
$date2=strtotime("$date2 00:00");
$difference = intval(($date2-$date1)/86400+1); --------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top