wmguk Posted May 29, 2008 Share Posted May 29, 2008 Hey guys, The discount field holds the amount of weeks that the discount applies for. I'm going to create a script and what I need to is: get today's date. check field 'discount' (will be 3 or 4 or something like that) add the result to todays date and then run an update script to input the date to my database in date field 'discdate' I can get todays date, and i can do the update but I have googled and I cant seem to get a definate answer, how can i add 4 weeks to the date? Quote Link to comment Share on other sites More sharing options...
thebadbad Posted May 29, 2008 Share Posted May 29, 2008 <?php //2008-05-29 $today = date('Y-m-d'); //4 weeks $discount = '4'; //add $discdate = date('Y-m-d', strtotime("$today +$discount weeks")); echo $discdate; //2008-06-26 ?> Quote Link to comment Share on other sites More sharing options...
wmguk Posted May 29, 2008 Author Share Posted May 29, 2008 wow, you have done the whole thing for me!! Thank you I wasnt sure if you could just add +4 or how to do it. Thank you again Quote Link to comment Share on other sites More sharing options...
thebadbad Posted May 29, 2008 Share Posted May 29, 2008 Already had an example laying around, so why not post it Quote Link to comment Share on other sites More sharing options...
thebadbad Posted May 29, 2008 Share Posted May 29, 2008 And BTW, please mark the topic as solved. Quote Link to comment 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.