Hello there
I'm working on a sorta calendar project to be used with studies. It's a pretty simple PHP program, that lists some appointments and the status of those. The whole focus is to keep track of my deadlines. I was thinking it would be really cool, if i could make the program tell me how many days there is from the current date till deadline.
In short:
Is there a way to compare 2 dates (deadline and localtime) and output the time between them? Be it seconds, minutes whatever.
Thanks in advance
Chorage
The time between two dates
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: The time between two dates
If you store the deadline date using php function time() and compare it with time() now then yes you can do anything!
Re: The time between two dates
Thanks a bunch, that worked for me 
$timedifference = strtotime($deadline) - time();
or in days: $timedifference = (strtotime($deadline) - time())/3600/24;
$timedifference = strtotime($deadline) - time();
or in days: $timedifference = (strtotime($deadline) - time())/3600/24;