Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

String to timestamp conversion

807605Jul 9 2007 — edited Jul 9 2007
I have a string of the format yyyyMMdd:hh:mm:ss.SSSSS.
I need to convert it to a timestamp value of
the format dd-MMM-yy hh.mm.ss.SSSSS.

I tried the following
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
java.util.Date date = sdf.parse(stdate);
java.sql.Timestamp t = new java.sql.Timestamp(date.getTime());

but it didnt work.

Any help will be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2007
Added on Jul 9 2007
3 comments
2,354 views