This discussion is archived
4 Replies Latest reply: Mar 3, 2009 8:10 AM by 807588 RSS

Date Formatting

807588 Newbie
Currently Being Moderated
I have a java.sql.Timestamp object which is storing a date and a feature I am trying to implement is for users to change this date and then saving it back. To make it easier to read for the user I have used a DateFormat to display it so the format of the date changes. However, my problem arises as when I allow the user to change the date in the JTextField, how can I parse it back so that it is back in the format of the Timestamp.

When I try and save the users changes to start date, I am using a setStartDate method I have made which takes in a Timestamp object. Therefore, how can I change the String input from startDateTF which is using the DateFormat to a Timestamp object? The DateFormat I am using is
df1 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT)
If anybody has any suggestions or any better ways this can be acheived in terms of user interaction it would be much appreciated.