[ https://issues.apache.org/jira/browse/HIVE-7449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14073511#comment-14073511 ]
Johndee Burks commented on HIVE-7449: ------------------------------------- The problem is not the UDF but the implementation of java.util.TimeZone. Specifically the timezone IDs that TimeZone.getTimeZone() accepts. The code is below from the UDF: /hive/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUtcTimestamp.java {code} 78 if (arguments.length > 1 && arguments[1] != null) { 79 Text text = textConverter.convert(arguments[1].get()); 80 if (text != null) { 81 timezone = TimeZone.getTimeZone(text.toString()); 82 } 83 } else { 84 return null; 85 } {code} It does not accept PDT or EDT. The utility does have them but they are EST5EDT and PST8PDT. If you use these in the UDF you get the correct result. You can get a list of all the supported IDs using the simple program found http://obscuredclarity.blogspot.com/2010/08/get-all-timezones-available-in-timezone.html. I did this on my local system and got a list similar to the one shown at the bottom of page http://tutorials.jenkov.com/java-date-time/java-util-timezone.html. I tested this and it works, see below. {code} hive> SELECT from_utc_timestamp('2014-07-18 18:15:29.0','PST8PDT') FROM sfo_source LIMIT 1; ... 2014-07-18 11:15:29 {code} > from_utc_timestamp and to_utc_timestamp not returning right values > ------------------------------------------------------------------ > > Key: HIVE-7449 > URL: https://issues.apache.org/jira/browse/HIVE-7449 > Project: Hive > Issue Type: Bug > Affects Versions: 0.10.0, 0.12.0 > Reporter: Mala Chikka Kempanna > > Tested it out like below > 1.Get UTC and local time > date -u > Fri Jul 18 18:15:29 UTC 2014 > Local time > date > Fri Jul 18 11:15:32 PDT 2014 > 2. Conversion output on HIVE 0.10.0 and HIVE 0.12.0 > From UTC to local > SELECT from_utc_timestamp('2014-07-18 18:15:29.0','PDT') FROM sample_07 LIMIT > 1; > 2014-07-18 18:15:29 - Wrong output , it is supposed to be 2014-07-18 11:15:32 > From local to utc > SELECT to_utc_timestamp('2014-07-18 11:15:32.0','PDT') FROM sample_07 LIMIT > 1; > 2014-07-18 11:15:32 - Wrong output , it is supposed to be 2014-07-18 18:15:29 -- This message was sent by Atlassian JIRA (v6.2#6252)