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

Arun Avanathan edited comment on LANG-1638 at 9/14/21, 4:13 AM:
----------------------------------------------------------------

There is more history to this question - 
[https://stackoverflow.com/questions/8686331/y-returns-2012-while-y-returns-2011-in-simpledateformat]
 . {{Y}} gives weekYear if Calendar supports Weekyear 
{{getCalendar().isWeekDateSupported()}}; 

This bug should be closed on Commons with detailed documentation of the 
recommended pattern in using {{DateFormatUtils.format()}}


was (Author: aavanathan):
There is more history to this question - 
[https://stackoverflow.com/questions/8686331/y-returns-2012-while-y-returns-2011-in-simpledateformat]
 . {{Y}} gives weekYear if Calendar supports Weekyear 
{{getCalendar().isWeekDateSupported()}}; 

> commons-lang3-3.11 - Date 
> --------------------------
>
>                 Key: LANG-1638
>                 URL: https://issues.apache.org/jira/browse/LANG-1638
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.11
>         Environment: Production
>            Reporter: Shailendra Soni
>            Priority: Major
>
> December 27th to 31st 2020 gets converted into 2021 while trying to use 
> `DateFormatUtils.format` method. 
> {code:java}
> import org.apache.commons.lang3.time.DateFormatUtils;
> import org.apache.commons.lang3.time.DateUtils;
> public class DateEx {
>     public static void main(String... args) throws Exception{
>         String startDateStr = "2020-12-31";
>         String startDate = DateFormatUtils
>                 .format(DateUtils.parseDate(startDateStr, "YYYY-MM-dd"), 
> "YYYY-MM-dd-HH.MM.SS.mmmmmm");
>         System.out.println("startDate with Timestamp - " + startDate);
>     }
> }
> {code}
>  
> Actual Output -  2021-12-31-00.12.00.000000
> Expected Output - 2020-12-31-00.12.00.000000
>  
> Can someone look into it.
>  
> Version :-
>  # Java -> 1.8.0_212-b10
>  # Common-lang3 -> 3.11
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to