How to catch default error when invalid datetime format entered in dateTimeField?

How to catch default error when invalid datetime format entered in dateTimeField?. If we catch the error it will be useful to validate for other dependencies like to enable/disable button. 

Eg: How to save the default error message in a variable which we found red colored text in the below screenshot?

  Discussion posts and replies are publicly visible