You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Arun Avanathan (JIRA)" <ji...@apache.org> on 2019/07/11 04:17:00 UTC
[jira] [Comment Edited] (LANG-1462) After version Commons-lang3.4
DateFormatUtils has a bug
[ https://issues.apache.org/jira/browse/LANG-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16882642#comment-16882642 ]
Arun Avanathan edited comment on LANG-1462 at 7/11/19 4:16 AM:
---------------------------------------------------------------
[~britter] [~ggregory1] In DateFormatUtils.java, we have this
{code:java}
public static String format(Calendar calendar, String pattern) {
return format((Calendar)calendar, pattern, (TimeZone)null, (Locale)null);
}
{code}
We could replace it with
{code:java}
public static String format(Calendar calendar, String pattern) {
return format((Calendar)calendar, pattern, calendar.getTimeZone(), (Locale)null);
}{code}
Let me know what you guys think & if you agree, I could open a PR.
was (Author: aavanathan):
[~britter] [~ggregory1] We have this
{code:java}
public static String format(Calendar calendar, String pattern) {
return format((Calendar)calendar, pattern, (TimeZone)null, (Locale)null);
}
{code}
We could replace it with
{code:java}
public static String format(Calendar calendar, String pattern) {
return format((Calendar)calendar, pattern, calendar.getTimeZone(), (Locale)null);
}{code}
Let me know what you guys think & if you agree, I could open a PR.
> After version Commons-lang3.4 DateFormatUtils has a bug
> -------------------------------------------------------
>
> Key: LANG-1462
> URL: https://issues.apache.org/jira/browse/LANG-1462
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.time.*
> Affects Versions: 3.5, 3.6, 3.7, 3.8, 3.9, 3.8.1
> Reporter: Lijun Liang
> Priority: Critical
>
> The code is as follows :
> Calendar cale = Calendar.getInstance();
> System.out.println("Old time is " + DateFormatUtils.format(cale, "yyyyMMddHHmmss"));
> cale.setTimeZone(TimeZone.getTimeZone("JST"));
> System.out.println("New time is " + DateFormatUtils.format(cale, "yyyyMMddHHmmss"));
>
> The results of commons-lang3 3.4:
> Old time is 20190605144536
> New time is 20190605154536
>
> The results of the version after commons-lang3 3.4:
> Old time is 20190605144536
> New time is 20190605144536
>
> We found that the time zone setting was invalidated when it was formatted
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)