Mykel Alvis wrote:
The string I receive from a service is formatted as "3 PM CST 18 MAR
06". Time zones are relevant, and I do have an offset available as
"-6". However, according to the documentation I think I should be
able to parse the supplied string as
DateTimeFormat.forPattern("hh aa zzz dd MMM yy")
Inevitibly, I get a :
java.lang.IllegalArgumentException: Invalid format: "3 PM CST 18 MAR
06" is malformed at "CST 18 MAR 06"
The reason for this is that 'CST' is a short format time zone name.
These are unclear and ambiguous hence we don't parse them.
It is fustrating however to have Joda-Time unable to do something the
JDK can so maybe we should look at changing this somehow.
In the meantime, you can:
a) Use SimpleDateFormat :-(
b) Split the input yourself and parse the timezone yourself
c) Implement the Joda-Time DateTimeParser interface yourself to match
'CST' into a proper DateTimeZone, and then use DateTimeFormatterBuilder
to create a combined parser using patterns and your implementation thus
creating a full parser.
Stephen
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest