Add 3 months to a posted date in Insert behavior
Hi Ray, I've buit an online calendar reminder system which allows users to log specific events. There is one event that occurs quarterly, so rather than asking users to insert the event 4 times I've added a second insert behavior on the page that triggers if the user selects that particular event, and it should automatically add duplicate entries with dates of 3, 6 & 9 months after the entered date - so for example if the user adds the event dated 30 November 2021, I want it to also add entries for 28 February, 30 May and 30 August 2022. I've only added a 3 month increment so far for testing - the insert behavior works but the date doesn't, it's defaulting to a 1970 date. This is my current line from the Insert behavior:
$InsertQuery->bindColumn("EventDate", "t", "".((isset($_POST["datepickerDefault"]) && $_POST["datepickerDefault"]!="" )?date("Y-m-d", strtotime("+3 month", $_POST["datepickerDefault"])):"") ."", "WA_DEFAULT");
I'm assuming I've put the + 3 month in the wrong place - can you advise? Also, I believe there are issues with adding date increments if the date falls on the last day of the month and so will cause problems for dates of 31st (and 29th/30th in the case of February). Do you know how I can get around this?