CreativeLogic
05-19-2004, 01:36 PM
I need some help with a php date problem I have. I want to check to see if it has been 5 days since someone has signed up. When they signed up I put the date in YYYY-MM-DD HH:MM:SS format. I need to build a query that will check to see if it has been 5 days since they have signed up. Any help would be much apperciated.
zupanm
05-19-2004, 01:52 PM
its better to use unix timestamps for this.. it'll save you a lot of headaches.. then you can just check for X number of seconds away from the current.. you can convert it to a unix timestamp though..
use mktime from your date you have saved.. then use time() for the current time and do the math.
azizny
05-19-2004, 01:58 PM
Originally posted by zupanm
its better to use unix timestamps for this.. it'll save you a lot of headaches.. then you can just check for X number of seconds away from the current.. you can convert it to a unix timestamp though..
use mktime from your date you have saved.. then use time() for the current time and do the math.
How is the unix time stamp begotten?
CreativeLogic
05-19-2004, 02:21 PM
I wish I would have used timestamps... But I didn't... Are those mysql functions I can use?
CreativeLogic
05-19-2004, 02:27 PM
Any give me some actual code though? It should be a simple query I just have no clue how to do it...
SELECT user_id FROM member WHERE mktime(created_on) < time() + 5 days
sasha
05-19-2004, 03:15 PM
SELECT user_id FROM member WHERE now() < DATE_ADD ( created_on , INTERVAL 5 DAY )
CreativeLogic
05-19-2004, 03:17 PM
Great... Thank you... im not too good with the mysql functions yet... ill test that out now...
intername
05-19-2004, 03:37 PM
How is the unix time stamp begotten?
Use a function called time() to get the current the unix timestamp, for example:
<?php echo time(); ?>
CreativeLogic
05-19-2004, 05:06 PM
That worked! Thanks for the help!