Hi Rohit
In JavaScript when an arithmetic operation fails it does not throw an error; instead it returns a special numeric value, called NaN (for Not a Number), and the program happily continues with execution. The following operations all result in NaN:
0 / 0; => Nan.
"Hi" / 1; => Nan. "Hi" cannot be converted to number
NaN / 0; => Nan. Any operation with NaN results in NaN
The JavaScript typeof operator does not distinguish between NaN and numbers, therefore the expression typeof NaN === "number" returns true. Furthermore, NaN does not compare equal to any number, including a comparison with itself, thus NaN == NaN returns false
So use SimpleDateFormat may be help you.
BR,
Durga.