Date parsing problem

I am getting parse exception while I am trying to format the follwing date " 02:09:07 Jan 26, 2002 PST " using java.text.DateFormat and SimpleFormat class.

I want convert this string to Java.util.Date object. How do I convert that as Date object.

If there is still some option in either of the above classes please tell me in detail( Sample code might help).

Thanks in Advance

V Sivakumar

[422 byte] By [v_sivakumara] at [2007-9-28 11:46:50]
# 1
Try this pattern in the SimpleDateFormat constructor:"HH:mm:ss MMM dd, yyyy zzz"The patterns are well documented in the api... http://java.sun.com/j2se/1.4.1/docs/api/java/text/SimpleDateFormat.html
samlewis23a at 2007-7-12 2:35:48 > top of Java-index,Archived Forums,Java Programming...
# 2

hmm, can't be first post anymore :(

anyhow, i tryed to create some code and here's what i came up withimport java.text.SimpleDateFormat;

import java.util.Date;

public class SDF {

public static void main(String[] args) throws Exception {

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss MMM d, yyyy z");

System.out.println(sdf.format(new Date()));

System.out.println(sdf.parse(args[0],

new java.text.ParsePosition(0)));

}

}

you just compile it javac SDF.java and run it java SDF "09:09:23 Jaan 12, 2002 EET" (or whatever argument works for you)

anyhow, it prints out current date, so you can see how it formats date according to that format string....

i notieced that in my countri this MMM is shown as Jaan, Veebr, ... so, that's why i got null most of times while i tryed to use string that you had...

oh, and that java.text.ParsePosition was necessary as well...

VaskoLa at 2007-7-12 2:35:48 > top of Java-index,Archived Forums,Java Programming...