Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to parse a non-standard Date?

 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to parse a non-standard date string like the following
2008-12-05T10:58:04.197-05:00
. Using a SimpleDateFormat string such as
yyyy-MM-dd'T'HH:mm:ss.SSSZ
won't work because the timezone portion of the date doesn't follow either of the two supported formats. Is there any way to get the formatter to accept this date?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Phillipe,
How about converting the string to the standard "-0800" first? You could use a string method call to get rid of the last colon.
 
Mike Simmons
Ranch Hand
Posts: 3038
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, what she said.
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. That's what I ended up doing. Just thought there was some more... elegant way to do this. Oh well.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic