I have some old data which contains dates as strings and I’d like to fix it. Plus, filter any new data that may show up this way.
Let’s use the date January, 12 2000 as our date. In the strings it may show up as 01-12-2000, or 2000-12-01, or 12-01-2000, etc… Are there any available functions to parse those strings and correctly break the date into yyyy,mm,dd?
If both the month and day component have values below 13, it’s not possible to distinguish which is which. strtotime() will make a guess, but a wrong answer may not be acceptable to you. But, otherwise a simple explode() will work.