I am pulling a date and it only has the month and day. I need to add the year before saving to database. The dates being pulled only go as far a year off. Is there a way to do this?
The way I am receiving the date is Nov 12 or "M d"
I am pulling a date and it only has the month and day. I need to add the year before saving to database. The dates being pulled only go as far a year off. Is there a way to do this?
The way I am receiving the date is Nov 12 or "M d"
So the year can be 2010 or 2009 right?
if (strtotime($date . date('-Y')) > time()) {
// year ago
$date .= date('-Y', strtotime('last year'));
} else {
$date .= date('-Y');
}
// date('-Y') will return -2010 or -2009