AbcAeffchen\SepaUtilities\SepaUtilities::sanitizeDateFormat
Tries to convert the given date into the format YYYY-MM-DD (Y-m-d). Therefor it tries the following input formats in the order of appearance: d.m.Y, d.m.y, j.n.Y, j.n.y, m.d.Y, m.d.y, n.j.Y, n.j.y, Y/m/d, y/m/d, Y/n/j, y/n/j, Y.m.d, y.m.d, Y.n.j, y.n.j.
Notice that this method tries to interpret the first number as day-of-month. This can lead to wrong dates if you have something like the 1st of April 2016 written as 04.01.2016. This will be interpreted as the 4th of January 2016. This is why you have to call this method on your owen risk and it is not included in the sanitize() method.
Signature
public function sanitizeDateFormat(string
$input,
[array
$preferredFormats = ] )
Parameters
$input
— string- The date that should be reformatted
$preferredFormats
— array- An array of formats that will be checked first.
Returns
- string|false
- The sanitized date or false, if it is not sanitizable.