Conversion of one date format to another format..

Hi all..Please help me out in this... I want to convert the following ...Fri May 25 17:49:34 2007 to 2007-05-25 17:49:34 Help me out of this ... Thanks in Advance .....
[224 byte] By [Ragav_Msca] at [2007-11-27 5:30:03]
# 1
Use one SimpleDateFormat to parse the input and a second to format the output.
sabre150a at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 2
Please give me one example or any thread link to get in detail.. i am trying with simpledateformat only i can's made it...
Ragav_Msca at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 3
There are examples in the Javadoc. Have you looked at it?
sabre150a at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 4

> Fri May 25 17:49:34 2007 to 2007-05-25 17:49:34

If what you have already is of type java.util.Date, then just use formatting:

new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(yourDate)

If it's a String only, then you need to do conversion:

SimpleDateFormat from = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");

SimpleDateFormat to = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

to.format(from.parse(yourString))

quittea at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 5
Then where will be the result of the converted Data i can get...
Ragav_Msca at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 6
> Then where will be the result of the converted Data i can get...Both examples I gave state an expression resulting in a value of type String which, for example, can be passed to System.out.println() or whatever.
quittea at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...
# 7
Hi... Thanks i got the converted date... Thanks a lot... Bye...
Ragav_Msca at 2007-7-12 14:53:46 > top of Java-index,Java Essentials,Java Programming...