How to convert a string to a SQL date

 









Steps

  1. SimpleDateFormat - create a class that encapsulates the format of the date you are creating. 
  2. Parse the date sent using the method to ensure it meets date formatting requirements. Throw a parse exception if the date is invalid.
  3. Create a sqlDate from the parsed date. Use the number of milliseconds from January 1, 1970, 00:00:00 GMT as an input into the method. This ensures the accuracy of the formed SQL date.
  4. Return the sqlDate to the method caller. 


Comments

Popular posts from this blog

Vaadin - GRID Component

Connecting a Vaadin SQL Container to a Combo Box

Web Cam and Vaadin