You can see all the accepted datetime formats here.
$timeString = 'Y-m-d';
$this->isDateTimeFormat($trimeString); // returns true
$this->isDateTimeFormat('Sponge Bob'); // returns false
I am not interested in solving this with regex, I already have one problem. But perhaps someone knows of a way to check if a string fits the requirements and then throws an exception if it doesn't?
Thanks :)