[
https://issues.apache.org/jira/browse/LANG-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16805769#comment-16805769
]
Michael Osipov commented on LANG-1432:
--------------------------------------
I'd be inclined to closed to this one because using {{zzz}} is a plain broken
approach and those three-letter codes are ambigious. Use, wherever you can, ISO
8601 along with {{XXX}}.
> FastDateFormat doesn't parse time string with timezone correctly
> ----------------------------------------------------------------
>
> Key: LANG-1432
> URL: https://issues.apache.org/jira/browse/LANG-1432
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.time.*
> Affects Versions: 3.8.1
> Environment: jdk 1.8
> Reporter: Simon Xianyu
> Priority: Major
>
> FastDateFormat doesn't parse the pattern correctly :
> "EEE MMM dd HH:mm:ss zzz yyyy"
> The test code is as following:
>
> {code:java}
> // code placeholder
> public class TestFastDateFormat {
> public static void main(String[] args) throws ParseException {
> Date d = new Date();
> String dstr = d.toString();
> System.out.println(dstr);
> String pattern = "EEE MMM dd HH:mm:ss zzz yyyy";
> FastDateFormat fdf = FastDateFormat.getInstance(pattern,
> Locale.US);
> Date d1 = fdf.parse(dstr);
> System.out.println(d1);
> // Use SimpleDateFormat to parse string
> SimpleDateFormat sdf = new SimpleDateFormat(pattern);
> Date d2 = sdf.parse(dstr);
> System.out.println(d2);
> }
> }
> {code}
> The test result example:
> Tue Feb 12 16:07:53 CST 2019 /// this is origin result
> Wed Feb 13 06:07:53 CST 2019 /// this is result of FastDateTime.parse()
> Tue Feb 12 16:07:53 CST 2019 /// this is result of
> SimpleDateFormat.parse()
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)