hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vidya Sujeet <sjayatheer...@gmail.com>
Subject Converting datime formats in Hive - please help
Date Sun, 26 Oct 2014 18:55:32 GMT
Hi,

The date time format coming from the source is* "25-FEB-01' .* I want to
convert it to the following format. *'MM/DD/YYYY' *. How can we do this in
Hive?


I see that as per the documentation

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions

I could possibly convert the string date to a Unix time stamp in seconds
using the below UDF. However, what is the string pattern if the date at
source is coming this way* "25-FEB-01'* ? The link provided to look up for
the patterns does not work.

Please help.

*Name:* unix_timestamp (string date, string pattern) function.
*Description: *Convert time string with given pattern (see [
http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html])
to Unix time stamp (in seconds), return 0 if fail:
unix_timestamp('2009-03-20', 'yyyy-MM-dd') = 1237532400.



Vidya

Mime
View raw message