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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to parse the String to YYYY-MM-DD format in Java

Status
Not open for further replies.

HotCake

Programmer
Oct 20, 2003
3
0
0
IN
Hi,
How to parse this date 'Fri Mar 22 00:00:00 IST 2002' to yyyy-MM-dd (2003-02-05)
 
You do something like this:

SimpleDateFormat dtp = new SimpleDateFormat("dd-MM-yy");
Date dt = dtp.parse("01-02-03", new ParsePosition(0));
System.out.println(dt);
SimpleDateFormat dtp1 = new SimpleDateFormat("dd-MMM-yy");
Date dt1 = dtp1.parse("01-jan-03", new ParsePosition(0));
System.out.println(dt1);
System.out.println(new Date());


Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top