Apache Presto - Date and Time Operator


Query 1

presto:default> select date '2016-06-20' + interval '2' day as date_add; 

Result

 date_add 
------------ 
 2016-06-22 

The above output indicates two days are added from the specified date using an interval data type.

Query 2

presto:default> select time '12:30' + interval '1' hour as time_add; 

Result

   time_add 
-------------- 
 13:30:00.000 

Here, one hour is added from the given time.

Query 3

presto:default> select timestamp '2016-06-21 12:32' + interval '2' year 
as timestamp_add;

Result

   timestamp_add 
------------------------- 
 2018-06-21 12:32:00.000 
apache_presto_basic_sql_operations.htm
Advertisements