PHP DateTime accept multiple formats?
- by John Smith
I'm trying to construct a DateTime object with multiple accepted formats.
According to the DateTime::createFromFormat docs, the first parameter (format) must be a string. I was wondering if there was a way to createFromFormats.
In my case, I want the year for my format to be optional:
DateTime::createFromFormat('Y-m-d', $date);…