Difference between time() and current time() PHP
I'm currently creating a subscription membership for my website.
I'm storing the date their subscription started in my database using time() (n开发者_运维问答ot extra parameters)
If not, how can i find the number of days between the current time() and the time() stored in the database?
Thanks!
The difference between them is the number of seconds.
There are 3600*24 seconds in a day. Math works here too. Who knew.
You can use microtime
instead to store and compare it:
$diff = ($micro_time_from_db - microtime());
echo date('d', strtotime($diff));
精彩评论