[
https://issues.apache.org/jira/browse/LANG-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Simon Xianyu updated LANG-1432:
-------------------------------
Description:
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()
was:
FastDateFormat doesn't parse the pattern correctly :
"EEE MMM dd HH:mm:ss zzz yyyy"
The test code is as following:
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);
}
}
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()
> 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)