Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Conversion

Status
Not open for further replies.

natncm70

MIS
Jan 16, 2002
66
IN
Hello,

I am having a String Variable with Date Format. I need to convert that String Variable to Date.What should i do for that? Please Help me
Regards
 
Use the java.text.SimpleDateFormat class

you can supply a format to that class and then use the parse(string) function


eg in pseudo code:

java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd/MM/yyyy");


formatter.parse( string here);

this gives you a java.util.Date

if you need a java.sql.date just do

new java.sql.date(java.util.Date.getTime())



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top