this is the code which returns Date but at the client side i am getting
2016-12-26 14:18:57.0 at the client side . what is the possible solution .. I am using node.js at the client side. But I think it has nothing to do with this problem . I WANT TO REMOVE THIS 0
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date date = sdf.parse(value);
if (!value.equals(sdf.format(date))) {
date = null;
}
return date != null;
You are not giving a format pattern string to the SimpleDateFormat constructor, so it uses some default pattern. The solution is to provide a proper format string.
The formatting can be done like this:
which would result e.g. in
You want to omit the S format symbols (milliseconds) in the format string. E.g.:
Of course you need to change this example to your format needs. Play a bit with the order and number of symbols, confer the docs.