kevin4it Posted March 20, 2007 Share Posted March 20, 2007 My objective is the following: I want to only allow user to login to a survey only ever 2 weeks and also when it is open, only have it accessible for 4 days. Completed so far: I have it set with a bunch of if's that it'll update a MySQL database with the appropriate date. I grab the local day of the month from the users PC, then add 14 and/or 4 to get my disable/activate dates. Everything updates fine in the DB. My problem is this: When I get a date, take today for instance March 20th, and add 14 days to it, it shouls bring it to April 3rd. But when I add the 14 to the 20 of course it comes up to 34. How can I add the 14 days, and have it come up with the right date? Let me know if there is anything I can post or add to help with this. Thanks. Kevin Quote Link to comment https://forums.phpfreaks.com/topic/43479-solved-dates-in-the-future-help/ Share on other sites More sharing options...
mjlogan Posted March 20, 2007 Share Posted March 20, 2007 always work with timestamps! just take a timestamp of now, 1174399450 and add (60*60*24*14) to it (14days in seconds) 1174399450+1209600 and you have 1175609050 which is Tuesday, April 3rd 2007, 14:04:10 (GMT) Quote Link to comment https://forums.phpfreaks.com/topic/43479-solved-dates-in-the-future-help/#findComment-211166 Share on other sites More sharing options...
kevin4it Posted March 20, 2007 Author Share Posted March 20, 2007 Great Thanks a lot, this is much appreciated. I am getting pretty good with PHP but still have hiccups along the way. I'll post back with an update. Thanks. Kevin Quote Link to comment https://forums.phpfreaks.com/topic/43479-solved-dates-in-the-future-help/#findComment-211168 Share on other sites More sharing options...
kevin4it Posted March 20, 2007 Author Share Posted March 20, 2007 Thank you very much, this worked like a charm!! Kevin Quote Link to comment https://forums.phpfreaks.com/topic/43479-solved-dates-in-the-future-help/#findComment-211172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.