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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.