I've been struggling with this for quite sometime, after few long hours spend on forums I came up with this code:
SELECT *, TIMESTAMPDIFF(SECOND,NOW(),`pay_date`) AS `expire` FROM `users`
pay_date
is datetime field which in the moment of tries had setup (current time + 7 days)
so NOW() is showing 03-09-2013 23:30:20; pay_date
is showing 10-09-2013 23:30:20. I'am using this code to extract my countdown:
echo $date['expire'];
It is working, its properly giving me amount of seconds left, what i dont know is how to make it to say something like:
2 years, 10 months, 20 days, 5 hours, 30 minutes, 46 seconds left
.
ive tried in few ways for instance date('d-m-Y H:i:s', $date['expire'])
but its giving me as output something like 1790-01-01, strtotime isnt also working, i dont know how to make it to work in the way i described above.