• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML dateTime to java.Date using SimpleDateFormat  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers!

I got a problem converting an XML dateTime String to a Date object.

The XML dateTime String looks like this:
2006-11-07T05:31:33Z

I tried to convert it this way:



From the results I found using google this should be correct . (?)
But it's always giving me a parsing error saying:

Unparseable date: "2006-11-07T05:31:33Z"

And well I can't figure out how to do it.

I hope someone here is able to give me a hint at least. ;)

Thanks a lot in advance.
 
Jan Spengen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again a very simple mistake, but I just didn't see it.

It has to be:



The Z for the timezone has to be 'Z'.
 
Sheriff
Posts: 22845
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad you found the answer. But the use of SimpleDateFormat is nothing to do with XML so I will move this to Java in General (Intermediate).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!