You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Duncan Jones (JIRA)" <ji...@apache.org> on 2014/09/28 08:31:33 UTC

[jira] [Commented] (LANG-1000) ParseException when trying to parse UTC dates with Z as zone designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT

    [ https://issues.apache.org/jira/browse/LANG-1000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151003#comment-14151003 ] 

Duncan Jones commented on LANG-1000:
------------------------------------

I'm able to reproduce this too. It seems that "ZZ" has no special meaning within the parser classes, despite the Javadoc promising the contrary. In {{FastDateParser.getStrategy()}}, only the first 'z' is noticed and a general timezone strategy is returned.

As a side note, as and when we move to Java 7 as the minimum supported API, we can use the new "X" pattern letter, which is designed for ISO 8601 time zones.

In the meantime, I'll see what can be done in the current API. A work-around for now is to substitute "+00:00" for "Z" in the input date, prior to parsing.

> ParseException when trying to parse UTC dates with Z as zone designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-1000
>                 URL: https://issues.apache.org/jira/browse/LANG-1000
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.3.2
>            Reporter: Holger Stenzhorn
>            Priority: Minor
>             Fix For: Patch Needed
>
>
> I have the {{String}} {{2013-11-18T12:48:05Z}} which I want to parse into a {{Date}} using {{DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT}}. 
> According to [http://en.wikipedia.org/wiki/ISO_8601#UTC] the {{Z}} at the end should be a valid abbreviation for {{UTC+00:00}} (or {{UTC}}) and so all should be fine.
> But when I am trying to do so I get the following exception:
> {code}
> java.text.ParseException: Unparseable date: "2013-11-18T12:48:05Z" does not match
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)