amazon web services - AWS Athena date_Part -


i'm trying truncate date day using athena. here's input , select statement like:

create table ... usagestartdate timestamp, usageneddate timestamp,  ... row format serde 'org.apache.hadoop.hive.serde2.lazy.lazysimpleserde' serdeproperties ( 'serialization.format' = ',', 'field.delim' = ',', "timestamp.formats" = "yyyy-mm-dd't'hh:mm:ss.sssss'z'")  location 's3:  day  select... resource string day(usagestartdate) sum(usagehours) 

to retrieve date of timestamp column need use datetime functions underlying prestodb engine.

so resulting select this:

select date(usagestartdate) date,        date_diff('hour',usagestartdate,usageenddate) hours usagetable 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -