Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9BFF100FD for ; Fri, 13 Jun 2014 00:46:01 +0000 (UTC) Received: (qmail 49238 invoked by uid 500); 13 Jun 2014 00:46:00 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 49177 invoked by uid 500); 13 Jun 2014 00:46:00 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 49169 invoked by uid 99); 13 Jun 2014 00:46:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2014 00:46:00 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of nishant.k02@gmail.com designates 209.85.128.175 as permitted sender) Received: from [209.85.128.175] (HELO mail-ve0-f175.google.com) (209.85.128.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2014 00:45:57 +0000 Received: by mail-ve0-f175.google.com with SMTP id us18so2619084veb.6 for ; Thu, 12 Jun 2014 17:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=xeX2LsTrWw6/ZW0ARSdKNMmaBwVXhvkLf3UBkcxGBWM=; b=gREcX0YjEfJ6OJ18HBeSvF/yAqgdwj/wWK2GnanJ0LmlZp1dnzHdtHpQc+9PwgoHI0 Nl9jw04jjxm4ifuQBMbYG8IlhLYGKtnQ2jEC/zWLwHK0mN5fzbkCk4icxQ+D8Hglehtr bJ/7vJ1qEb11e4/SbDolTvZS5Bpq3mpVlJjXGVs5zJuHeTaclQUwcyEEhhit8MaR+Av9 fg8h+Hz6Gaej8F/Nvsf+ij7hLOnjCJ+0xx5txI0OnLak4RvFs8ZK8hIfehYB4tWicGUQ 6yM8KopfI+IkBoS/aSrtvoTUD6ZKDbD4GYdBQjzJy3y5kHqm08Urijj/qx4YBiDOmzYb O+lA== MIME-Version: 1.0 X-Received: by 10.58.220.230 with SMTP id pz6mr27162706vec.9.1402620332883; Thu, 12 Jun 2014 17:45:32 -0700 (PDT) Received: by 10.52.122.17 with HTTP; Thu, 12 Jun 2014 17:45:32 -0700 (PDT) In-Reply-To: References: Date: Thu, 12 Jun 2014 20:45:32 -0400 Message-ID: Subject: Re: Need help in Date format From: Nishant Kelkar To: user@hive.apache.org Content-Type: multipart/alternative; boundary=047d7bdc06c2b2455b04fbacfe96 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc06c2b2455b04fbacfe96 Content-Type: text/plain; charset=UTF-8 I'd try avoid using the Hive inbuilt from_unixtime and unix_timestamp functions. They are buggy, in that they depend on the cluster's timezone. So if some of your cluster nodes have a different timezone than others, these functions suffer. Right now, for what you want, it probably doesn't matter. But I'm just saying in general. BTW, Joda Time also has provisions to set/convert timezones :) On Thu, Jun 12, 2014 at 8:34 PM, Krishnan Narayanan < krishnan.smile@gmail.com> wrote: > Thank you very much it worked. > > > On Thu, Jun 12, 2014 at 5:21 PM, Gabriel Eisbruch < > gabrieleisbruch@gmail.com> wrote: > >> Hey, >> I think you can use from_unixtime(unix_timestamp(your_field, " >> dd-MMM-yyyy"),"dd-MM-yyyy") >> >> Thanks, >> Gabo. >> >> >> 2014-06-12 21:01 GMT-03:00 Krishnan Narayanan : >> >> Hi All, >>> >>> I have my date format as 08-Mar-2014 how to I change it to 08-03-2014? >>> Can I use regexp_replace. >>> >>> I tried below but not getting the desired output. >>> >>> >>> regexp_replace(started_dt,"\Jan|\Feb|\Mar|\Apr|\May|\Jun|\Jul|\Aug|\Sep|\Oct|\Nov|\Dec","\01|\02|\03|\04|\05|\06|\07|\08|\09|\10|\11|\12") >>> >>> Output: 09-1|2|3|4|5|6|7|8|9|10|11|12-2014 16:19:56. >>> Help is much appreciated. >>> >>> >>> Thanks >>> Krishnan >>> >>> >> > --047d7bdc06c2b2455b04fbacfe96 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'd try avoid using the Hive inbuilt from_unixtime and= unix_timestamp functions. They are buggy, in that
they depend on the c= luster's timezone. So if some of your cluster nodes have a different ti= mezone than
others, these functions suffer.

Right now, fo= r what you want, it probably doesn't matter. But I'm just saying in= general.

BTW, Joda Time also has provisions to se= t/convert timezones :)


On Thu,= Jun 12, 2014 at 8:34 PM, Krishnan Narayanan <krishnan.smile@gmail= .com> wrote:
Thank you very much it work= ed.

--047d7bdc06c2b2455b04fbacfe96--