Re: Need help in Date format

2014-06-12 Thread Nishant Kelkar
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.

Re: Need help in Date format

2014-06-12 Thread Nishant Kelkar
Hi Krishnan, Try writing your own UDF for it, it should be simple. For the internals of the UDF, I'd recommend Joda Time library: http://www.joda.org/joda-time/ For a good resource on how to write UDFs, here's something: http://blog.matthewrathbone.com/2013/08/10/guide-to-writing-hive-udfs.html

Re: Need help in Date format

2014-06-12 Thread Krishnan Narayanan
Thank you very much it worked. On Thu, Jun 12, 2014 at 5:21 PM, Gabriel Eisbruch wrote: > Hey, > I think you can use from_unixtime(unix_timestamp(your_field, " > dd-MMM-"),"dd-MM-") > > Thanks, > Gabo. > > > 2014-06-12 21:01 GMT-03:00 Krishnan Narayanan : > > Hi All, >> >> I have my da

Re: Need help in Date format

2014-06-12 Thread Andre Araujo
You can find this is a cheeky trick, but it works as a treat :) select printf('%s-%02.0f-%s', substr(started_dt,1,2), (2+instr('JanFebMarAprMayJunJulAugSepOctNovDec', substr(started_dt,4,3)))/3, substr(started_dt,8,4) ) On 13 June 2014 10:01, Krishnan Narayanan w

Re: Need help in Date format

2014-06-12 Thread Gabriel Eisbruch
Hey, I think you can use from_unixtime(unix_timestamp(your_field, "dd-MMM-" ),"dd-MM-") 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 n

Fwd: Need help in Date format

2014-06-12 Thread 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") O