I get my current date for PreparedStatement Oracle 9i insert like this:
I then use this for my insert setter:
Is there someway to format the entry that goes in the database? It currently inputs this in the database: 2008-10-15 11:23:00.807 I would like this instead: 15-Oct-08 11:23:00 PM
Nick, What data type do you have in the database? If it is Date/Timestamp (or your database equivalent), it is not stored in any format. When you query the column you would specify the format.
If it is stored as a varchar, you would want to use SimpleDateFormat to set your format. Then call stmt.setString() to use that format.
Needless to say, using a Date/Timestamp type in the database is recommended.
You dont have any control over the format the Timestamp is kept in the database. You can set the date time to what ever you want when you put it in of course . You can also control how you want to format it when you get a timestamp out of the database and display or print it somewhere.