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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtract Date Time or find difference

Status
Not open for further replies.

Kurt111780

Technical User
Nov 20, 2003
235
GB
Hello,

I need to find the difference between a timestamp in the database and the current time.

This adds time to the current time then it is stored in the database.
Code:
$timeStamp = date('YmdHis', strtotime('+' . $expireTime . 'hours'));

Then I get the timeStamp from the the database and need to find the difference between that and the current time.
Code:
$currentTime 	= date("YmdHis");
How do I find the difference between these two and output something like:

"7 hours 20 minutes" or "3 days 7 hours 10 minutes"

Thanks

It's only easy when you know how.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top