I need to check whether the given string is date object or not.
Initially I used
Date.parse(val)
If you check Date.parse("07/28/2014 11:23:29 AM")
, it'll work.
But if you check Date.parse("hi there 1")
, it'll work too, which shouldn't.
So I changed my logic to
val instanceof Date
But for my above date string, "07/28/2014 11:23:29 AM" instanceof Date
it returns false
.
So, is there any way with which I can appropriately validate my string against Date?