0

If 2011-11-26T03:53:00.001-0800 is yyyy-MM-dd'T'HH:mm:ss.SSSZ

Then what is 2011-11-26T03:53:00.001-08:00

Hope it explains everything what i need...

undone
  • 7,857
  • 4
  • 44
  • 69
amithgc
  • 6,167
  • 6
  • 29
  • 38
  • 2
    *Hope it explains everything what i need...* No it doesn't. What is the question here? – Harry Joy Nov 28 '11 at 06:18
  • if the date format of 2011-11-26T03:53:00.001-0800 is yyyy-MM-dd'T'HH:mm:ss.SSSZ, then what is the date format of 2011-11-26T03:53:00.001-08:00, Please note the difference between the two... -0800 and -08:00 – amithgc Nov 28 '11 at 06:20
  • 1
    Yes, it doesnt explain what you want. Please elaborate. – Drona Nov 28 '11 at 06:23
  • What do you want it for? – HashimR Nov 28 '11 at 06:25
  • Ok.. When im parsing an Atom feed im getting the date as 2011-11-26T03:53:00.001-08:00 and i want to parse it in Java using SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); So i need the date format.. – amithgc Nov 28 '11 at 06:30
  • @AmithGC: can you edit the date (that you are getting from the feed) a little bit? Like remove the `:` or add something in the date string? – HashimR Nov 28 '11 at 06:39
  • *"Hope it explains everything what i need..."* From the description it seems you need a personal man-servant. [What have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Andrew Thompson Nov 28 '11 at 07:49

2 Answers2

3

Ok, i've found a solution to your problem.

"The solution is possibly to use the data type converter in JAXB, since JAXB must be able to parse ISO8601 date string according to the XML Schema specification. javax.xml.bind.DatatypeConverter.parseDateTime("1999-01-01T23:59:59.999-08:00") will give you a Calendar object and you can simply use getTime() on it, if you need a Date object."

This is the link where i found the above answer.

You can simply use it like this:

Calendar cl = javax.xml.bind.DatatypeConverter.parseDateTime("1999-01-01T23:59:59.999-08:00");
System.out.println(cl.getTime());

Hope this helps. Cheers!

Community
  • 1
  • 1
HashimR
  • 3,803
  • 8
  • 32
  • 49
1
yyyy-MM-dd'T'HH:mm:ss.SSSz

From RFC822 Timezone to General timezone. See this

Mac
  • 14,615
  • 9
  • 62
  • 80
abhinav
  • 3,199
  • 2
  • 21
  • 25
  • Abhinav, i have read it before.. sadly, it has nothing which explains my problem... – amithgc Nov 28 '11 at 06:28
  • @AmithGC: note he used a lowercase "Z", not the uppercase "Z" you used. – Mac Nov 28 '11 at 06:33
  • @abhinav: please excuse the edit, I changed it to point to the format specifier of interest (i.e. the "timezone" specifier). – Mac Nov 28 '11 at 06:35
  • For this format to work your date string should be something like this `1999-01-01T23:59:59.999GMT-01:00`. – HashimR Nov 28 '11 at 06:51