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

Duncan Jones commented on LANG-654:
-----------------------------------

What's causing the confusion here  is that there *is* no Sun Oct 10 00:00:00 
CLST 2010. The hour between midnight and 1am simply doesn't exist.The time 
changes immediately to Sun Oct 10 01:00:00 CLST 2010. So it's not possible to 
truncate the date on this particular date in the Chilean time zone.

In case you're wondering, Java handles this situation by parsing midnight as 
1am:

{code:java}
TimeZone.setDefault(TimeZone.getTimeZone("Chile/Continental"));
String dateString = "2010-10-10 00:00:00.0";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
Date date = sdf.parse(dateString);
System.out.println(date);
{code}

Output: {{Sun Oct 10 01:00:00 CLST 2010}}.

Consequently, I don't believe this is a bug.

> DateUtils.truncate method is buggy when dealing with DST switching hours 
> -------------------------------------------------------------------------
>
>                 Key: LANG-654
>                 URL: https://issues.apache.org/jira/browse/LANG-654
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>    Affects Versions: 2.4
>         Environment: Operating System: Linux Red Hat
>            Reporter: Maxi
>             Fix For: Patch Needed
>
>
> DateUtils.trucate() does not work properly with daylight saving time.
> e.g.:
> Date:  2010-10-10 05:16:14.0
> DateUtils.truncate(date, Calendar.DATE) : Sun Oct 10 01:00:00 CLST 2010
> Instead of showing 10/10/2010, it shows 10/10/2010 01:00:00



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

Reply via email to