I have some data that I'm currently partition by date, but hive's date format is "YYYY-MM-DD" and I need to convert that to the european format which is "DD/MM/YYYY"
Is there a way to do it?
Related
Trying to convert data thats in DDDYYYY (i.e. 1112014) to a standard date format (Feb-02-2014). How would i go about doing this? I know how to do the inverse operation but I was unable to find any examples online of how to convert from DDDYYYY format to MM/DD/YYYY format.
Below is my attempt:
select to_date(to_char(1112018, 'DDDYYYY'), 'MM/DD/YYYY') from dual;
I have column value in my HIVE table in String format like 20160921091213 i.e. YYYYMMDDHHMMDD. In target I have two columns one timestamp and other date column. I want to extract the same in the format for timestamp "YYYY-MM-DD HH24:MI:SS" and for date in the format "YYYY-MM-DD".
What can be the possible SQL for that.
convert to unix timestamp format and then convert back to string.
from_unixtime(unix_timestamp('20160921091213', 'yyyyMMddHHmmss'),'yyyy-MM-dd HH:mm:ss')
Result: 2016-09-21 21:12:13
I have a table with column name "date". The date is structured as YYYY-MM-DD and i need to convert it to YYYYDDD
I don't think hive has any simple quick way of doing this..
Using hive version 0.13.0
You can do this with the unix timestamp functions. First defining your date format and converting to a unix epoch timestamp, and then converting the unix timestamp into the Julian date format.
-- this would give the output of 2016096
select from_unixtime(unix_timestamp('2016-04-05','yyyy-MM-dd'), 'yyyyDDD') from yourTableName
I am using a format string yyyy-MM-dd'T'HH:mm:ss
and its working great for dates like: 2014-02-20T05:25:03
What should be the format string when adding timezone like: 2014-02-20T05:25:03-07:00
Or 2014-02-20T05:25:03.366+05:00
I want to map a datetime mm/dd/yyyy hh24:mi:ss attribute in flatfile to Teradata table date yyyy-mm-dd attribute using informatica.
When I added to_date(date_field, 'yyyy-mm-dd') I'm encountering oracle fatal error. When I tried with to_date(to_char(date_field, 'yyyy-mm-dd')) it is giving invalid string input to to_date().
Can anyone help?
In Informatica, the format that you specify under to_date() function should be same as your source data format and not your target format.
So in your case, to_date function should be like this:
to_date (date_field, 'mm/dd/yyyy hh24:mi:ss')
This is because your flat file date has a format of mm/dd/yyyy hh24:mi:ss (Ensure that all the records in this column in your flat file date are really in this format - else you will encounter error)
Do not worry about target date format as long as the target column is a date datatype. By nature, date datatype does not have a format, it's only the display that needs format.