So I pondered like 2 hours over the following problem (and in the end could solve it through adding a seemingly very trivial detail...)
I was comparing a bunch of dateranges from the mysql database for overlap with a daterange requested by the user (userinput already sanitized).
I used the following if-statement from this thread: Determine Whether Two Date Ranges Overlap
(StartA <= EndB) and (EndA >= StartB)
When this condition was met, the user should have been declined his request due to overlap.
Now, as described in the title, I formatted the dateinput from the user to 'Y-m-d' format. Now, everything was fine except that when the end of the userinputted daterange touched the start of a daterange from the database. Then, the condition failed to discover the overlap. I was really confused and it took me 2 hours before I, out of despair, tried to format to "Y-m-d H:i:s", which is the format in the database as well (with H:i:s being set to 00:00:00) and see what happens.
And all of a sudden everything worked fine Oo Why? Im especially confused because ANY OTHER case was evaluated correctly, only this specific case described above wasn't. I'm pretty certain now that php must automatically do or assume something about the dates when they don't have the exact same format. But I don't know what exactly it does, and I'm really keen to know since it might help me at some point when facing a similar issue.
Thanks for your input!