tags:

views:

102

answers:

2

Hi, I'm currently creating a subscription membership for my website.

I'm storing the date their subscription started in my database using time() (not extra parameters)

If not, how can i find the number of days between the current time() and the time() stored in the database?

Thanks!

+2  A: 

The difference between them is the number of seconds.

There are 3600*24 seconds in a day. Math works here too. Who knew.

Tor Valamo
ok sorry, I didn't understand the complete functionality of time()Thank you very much for your answer.
Belgin Fish
that's 86400 if you're curious. It'll come up a lot if you do date comparisons with any frequency.
UltimateBrent
A: 

You can use microtime instead to store and compare it:

$diff = ($micro_time_from_db - microtime());
echo date('d', strtotime($diff));
Web Logic