Jump to content

Calculating Subscription Time Left?


Lukeidiot

Recommended Posts

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

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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.