if you want to check the format, you should use regular expressions in java and check the format using str.matches("Regex here")
(regex in java)
or if your format is kind of fixed, you can just check with str.contains(":")
to check for first format
4
solved How to check whether a date sting has a particular format [closed]