| Author |
how to parse a non-standard Date?
|
Philippe Desrosiers
Ranch Hand
Joined: Mar 29, 2006
Posts: 138
|
|
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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
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.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Mike Simmons
Ranch Hand
Joined: Mar 05, 2008
Posts: 2782
|
|
Yeah, what she said.
|
 |
Philippe Desrosiers
Ranch Hand
Joined: Mar 29, 2006
Posts: 138
|
|
Yep. That's what I ended up doing. Just thought there was some more... elegant way to do this. Oh well.
Thanks!
|
 |
 |
|
|
subject: how to parse a non-standard Date?
|
|
|