Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

how to convert yyyy-MM-dd HH:mm:ss to java.sql.Date

Thread view: 
sh - 02 Mar 2007 14:30 GMT
hi,

how to convert date in this format    yyyy-MM-dd HH:mm:ss     to
java.sql.Date

if i use directly     like this     java.sql.Date.valueOf(processDate)

am getting exception        java.lang.NumberFormatException: For input
string: "02 19:51:51"

if anybody knows reply back immedietely.

thanks in advance
www - 02 Mar 2007 16:15 GMT
> hi,
>
[quoted text clipped - 5 lines]
> am getting exception        java.lang.NumberFormatException: For input
> string: "02 19:51:51"

SimpleDateFormat myFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date myDate = new Date(myFormat.parse(your_time_string).getTime());
//need try-catch block

BWY, why you input "02 19:51:51"? It should be "2002-xx-xx 19:51:51",
based on your SimpleDateFormat.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.