How to check if given string is of specific date format?
gwt, java
Solution
Use the class
http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/shared/DateTimeFormat.html#parse(java.lang.String)
Which is in shared package.
Not the clinet package class
http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/DateTimeFormat.html#parse(java.lang.String)
Problem
I want to check if a given string is in a particular dateformat. If not user should be able to throw error message. ``` DateTimeFormat format=DateTimeFormat.getFormat("yyyy-MM-dd"); Date d= format.parse("1990-10-"); ``` with this input , it should give error. I tried with try and catch , but its not throwing any exception.