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

Nick Orka commented on HIVE-18358:
----------------------------------

To be precise, according to the documentation, it's "Week year". "Week in year" 
is "w". The problem is that whole year "YYYY" was providing correct 2017 year 
and it changed to 2018 for 12/31/2017 only. There is no real explanation what 
"Week year" means. I assume, this is a year of last day of a week and as 
12/31/2017 is Sunday, which is the first day of the week in USA. Thus "YYYY" 
returns a year for last day of the week which is 1/6/2018.

> from_unixtime returns wrong year for Dec 31 timestamps with format 'YYYY'
> -------------------------------------------------------------------------
>
>                 Key: HIVE-18358
>                 URL: https://issues.apache.org/jira/browse/HIVE-18358
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: AWS EMR with Hive 2.1.0-amzn-0
>            Reporter: Nick Orka
>            Assignee: Andrew Sherman
>              Labels: timezone
>
> If you use capital Ys as a year format in from_unixtime() it returns next 
> year for Dec 31 only. All other days work as intended.
> Here is reproduction code:
> {code:sql}
> hive> select from_unixtime(1514754599, 'YYYY-MM-dd HH-mm-ss'), 
> from_unixtime(1514754599, 'yyyy-MM-dd HH-mm-ss');
> OK
> 2018-12-31 21-09-59   2017-12-31 21-09-59
> Time taken: 0.025 seconds, Fetched: 1 row(s)
> hive>
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to