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!

Subtraction of two Dates

Status
Not open for further replies.

mirfan

Programmer
Feb 4, 2005
13
PK
hello
i need little help....

i want to calculate difference in days between two dates..

like one date is 31-01-2005 other is 05-02-2005... the difference should be 5...

Thanks
 
If the dates are stored in a db, you can use sql to do the calc for you. Check the docs for the correct way to do this.

Or with php, convert the dates to unix timestamps subtract and divide the total by the number of seconds in a day (60*60*24).

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
There is a FAQ on this very topic: faq434-3493
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top