SimpleDateFormat to check user date input // parsing String to dates in java

When developing user interfaces for management software you usually need to check what the user inputs in order to store the values in a database or a file. Java offers different alternatives to parse a String (normally the way user inputs values to the system) to other data types.

The class SimpleDateFormat from the package java.text offers a simple method to do this. You just have to call parse(String youDate) in order to get a java.util.Date.

Following you can find some code which explains this method and some of its particularities:

Leave a comment

Your email address will not be published. Required fields are marked *