With the site I am currently developing, a user has the ability to set a due date, as well as set a frequency for a task to be completed (weekly, fortnightly, monthly). Now, all was fine until I realised I had done a very stupid thing and converted all input data to integers instead of dates, so when a user selects monthly for example, being in December already, the next one goes to 13, or a month could have anywhere up to a million days... So, my question is how do I set it up so that it is recognised as a date, or at least acts like a date.
Current stupidity, goes something like this:
Code: Select all
if ($frequencydate = date("dmy")-1)
if ($frequency == 'monthly') {
$frequencydate = $frequencydate + 100; //100 being DD MM YY (DD M1 00)
}Code: Select all
if ($frequencydate = date("dmy")-1)
if ($frequency == 'monthly') {
$frequencydate = $frequencydate + date("m");
}