calculate time between two dates + times

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

Post Reply
benyboi
Forum Commoner
Posts: 80
Joined: Sat Feb 24, 2007 5:37 am

calculate time between two dates + times

Post by benyboi »

This may be too much to ask for, but I would like someone to tell me or point me in the right direction for the following:

I need a script to work out the time between two dates.

E.G. the time and days between now and say next sunday at 11AM.

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

2 × strtotime(). Find the difference.. that's how long it is in seconds.

You can convert that back to useful units via a script printf (that's the username, not the function) posted in Code Snippets a good long time ago.
Post Reply