kr3m3r Posted August 23, 2007 Share Posted August 23, 2007 Hi, I'm building a library with php, and want to create a way for the return date for an item to automatically be 14 days after they are checked out. I had hoped to use something like: $Check_Out_Date=TIMESTAMP[(]; and then manipulate that with substrings and whatnot, until i could put it back together as 2 weeks later. Unfortunately I'm getting a FATAL error, with this. Any recommendations would be really appreciated. Thanks for your time, -Robb Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/ Share on other sites More sharing options...
matthewhaworth Posted August 23, 2007 Share Posted August 23, 2007 There is no such function as TIMESTAMP is there? Could you perhaps print the full error? Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/#findComment-331483 Share on other sites More sharing options...
kr3m3r Posted August 23, 2007 Author Share Posted August 23, 2007 Well, the book I'm using said there was a timestamp()function, but I can't seem to find more on it. Now I'm trying to use date and the result I'm getting is: Warning: Wrong parameter count for date() in /home/.titch/rwkremer/kr3m3r.com/Sub_Check_Out.php on line 105 from the code: echo date(); I'm really just hoping to find a way to create a due date of 14 days from the date of check out. Thanks again for the help. -Robb Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/#findComment-331490 Share on other sites More sharing options...
matthewhaworth Posted August 23, 2007 Share Posted August 23, 2007 Well, the book I'm using said there was a timestamp()function, but I can't seem to find more on it. Now I'm trying to use date and the result I'm getting is: Warning: Wrong parameter count for date() in /home/.titch/rwkremer/kr3m3r.com/Sub_Check_Out.php on line 105 from the code: echo date(); I'm really just hoping to find a way to create a due date of 14 days from the date of check out. Thanks again for the help. -Robb Aye, the date function requires parameters, look it up on php.net. So, you need the date + 14 days applied to a variable that can be saved? Ok $newdate = date('d') + 14 . ' ' . date('m y'); echo $newdate; Hmm ,but that doesn't move it into the next month.. so I guess you could do and if on the result you get from simply adding 14 to the day number of the month? but then you'd have to index all the days in each month.. ill keep working on this for you The timestamp function, that regards the unix epoch time is time(); Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/#findComment-331508 Share on other sites More sharing options...
matthewhaworth Posted August 23, 2007 Share Posted August 23, 2007 I double posted for a reason, that reason is because this post defeats the object of the one previous $newdate = date('Y-m-d', strtotime('+14 day')); echo $newdate; Turns out there's an easier solution Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/#findComment-331516 Share on other sites More sharing options...
Fadion Posted August 23, 2007 Share Posted August 23, 2007 I find using strtotime() very handy, especially in such cases: $addDate = '14'; $date = date('d/m/Y', strtotime("+$addDate days")); It will calculate the date after 14 days and display it as: 02/05/2007 (ex. format). Quote Link to comment https://forums.phpfreaks.com/topic/66275-solved-effective-due-date-timestamp-fatal-error/#findComment-331517 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.