Lukeidiot Posted June 24, 2009 Share Posted June 24, 2009 Okay well its pretty straight forward. I am trying to calculate the Date a subscription will end, and how many days are left, based on a few variables (Starting date, and Subscription length) Stuff you might wanna know: (example)(i need a calculation for this, based on starting date) Subscription Start: June 24, 2009, 2:05 am Subscription End: July 24, 2009, 3:00 am Subscription Left: 30 days Subscription options: 3 Day Trial (259200 seconds) 30 Days (2592000 seconds) 90 Days (7776000 seconds) 6 Months (15778463 seconds) If you have any help on this issue, please feel free to make a post, thanks! Link to comment https://forums.phpfreaks.com/topic/163460-calculating-subscription-time-left/ Share on other sites More sharing options...
RussellReal Posted June 24, 2009 Share Posted June 24, 2009 you could just do.. $timeLeft = (strtotime($subEnd) - time()); $mins = floor($timeLeft / 60); $secs = $timeLeft - ($mins * 60); $hours = floor($mins / 60); $mins = $mins - ($hours * 60); $days = floor($hours / 24); $hours = $hours - ($days * 24); echo "You have {$days} days, {$hours} hours, {$mins} minutes and {$secs} seconds remaining of your subscription"; Link to comment https://forums.phpfreaks.com/topic/163460-calculating-subscription-time-left/#findComment-862512 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.