[ 
https://issues.apache.org/jira/browse/HIVE-1253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852279#action_12852279
 ] 

Zheng Shao commented on HIVE-1253:
----------------------------------

+1. Will test and commit.

> date_sub() function returns wrong date because of daylight saving time 
> difference
> ---------------------------------------------------------------------------------
>
>                 Key: HIVE-1253
>                 URL: https://issues.apache.org/jira/browse/HIVE-1253
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 0.6.0
>            Reporter: mingran wang
>         Attachments: HIVE-1253.patch
>
>
> date_sub('2010-03-15', 7) returns '2010-03-07'. This is because we have time 
> shifts on 2010-03-14 for daylight saving time.
> Looking at ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateSub.java, it is 
> getting a calendar instance in UTC time zone.
> def calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
> And use calendar.add() to substract 7 days, then conver the time to 
> 'yyyy-MM-dd' format.
> If it simply uses default timezone, the problem is solved: "def calendar = 
> Calendar.getInstance());"
> When people use date_sub('2010-03-15', 7), I think they mean substract 7 
> days, instead of substracting 7*24 hours. So it should be an easy fix. The 
> same changes should go to date_add and date_diff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to