MySQL Forums :: PHP :: Time remaining calculations
Time remaining calculations
Date: October 03, 2012 01:15PM
Good day all :)
I've been battling with a few calculations on dates / times, and have not made much headway with any of the hundreds of results I've visited from searching.
I'm working on a site where an item will be available for a certain amount of time (stored in the DB as days) from a creation date (stored as a timestamp). So, the expiry date would be creation date plus number of days.
What I am looking to do, is show time remaining, in days, hours, minutes, until the end of that 'expiry' day.
I have to use PHP 5.2, so am limited slightly there.
For days remaining, I've tried:
$VarDaysRemaining = round(abs(strtotime($VarCreateDate)-strtotime('+' . $VarCampaignLength . ' day', time()))/86400);
I did read that this gives an answer a day short.
Any pointers would be a great help.
Thank you in advance.
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.