Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert String to Java Date  RSS feed

 
ryan bohnert
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to convert a string to Java Date.



java.text.ParseException: Unparseable date: "2008-04-22T09:00:10.548-06:00"

Any suggestions?
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're parse string should be

2008-04-22T09:00:10.548GMT-06:00
2008-04-22T09:00:10.548Pacific Standard Time-06:00

or something like that.
 
Campbell Ritchie
Sheriff
Posts: 53732
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the SimpleDateFormat documentation. When you get to the Z bit for time zone, the example shown has -0800, not -08:00. It is different if you write z from if you write Z.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!