![]() |
[SOLVED] Adding Dates To A Set Date - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [SOLVED] Adding Dates To A Set Date (/showthread.php?tid=35289) |
[SOLVED] Adding Dates To A Set Date - El Forum - 10-25-2010 [eluser]defectivereject[/eluser] Hello again. So following on from my last calendar issue, i've gotten stuck adding dates. All i'm after is a simple "add 1 week onto this date" foreach time the date appears in this loop. whereas what i am getting is one week added to the original date requested no matter how many times it inserts the line incoming data: date_t = Day cell clicked on the calendar //want date intervals adding to this data_t - meeting/event details reoccurs = 1,2,3,4,5 e.t.c. as to how many weeks/fortnights you want to book the room time_t = simply a timeslot someone wants i.e. 9-11 or 130-230 e.t.c. My current query is as follows Code: function add_calendar_events($date, $data, $dateto, $time) { I can and will add on a check eventually to see if they requested every week or 2 weeks or monthly and then running the query necessary from the form selection to add on 7, 14, or a month days. Again most queries are done in MYSQL here purely for time factors and will be put into AR (Aside from the date ones as i can't see anything about adding dates in CI?) when done. [SOLVED] Adding Dates To A Set Date - El Forum - 10-25-2010 [eluser]Kamarg[/eluser] You need to update $added_date in your while loop. If you're wanting a php function to add dates, this is what I use. Code: function add_date($base_date, $days = 0, $months = 0, $years = 0){ [SOLVED] Adding Dates To A Set Date - El Forum - 10-25-2010 [eluser]defectivereject[/eluser] Changed my while loop as follows to update the date Code: while ($i <= $occurs) { No longer using MySQL to add 7 days as it didn't anyhow (!) and $new_date is the same value as the added_date from before |