I am parsing xml file. In this file there is one tag containing date string
"2008-11-10T05:51:33Z"
And I want convert this string in to java.util.Date object.
is there any body who will help me...
I am parsing xml file. In this file there is one tag containing date string
"2008-11-10T05:51:33Z"
And I want convert this string in to java.util.Date object.
is there any body who will help me...
Use java.text.DateFormat - or more likely, SimpleDateFormat.
Alternatively, go for Joda Time with its infinitely better API. Be careful with the Java built-in APIs - DateFormats aren't thread-safe. (They are in Joda Time, which uses immutable types almost everywhere.)
An (untested - should be fine except for possibly the timezone bit) example for the Joda Time API:
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyyMMdd'T'HH:mm:ssZ");
DateTime dt = fmt.parse("2008-11-10T05:51:33Z");