2

In CartoDB I want to add minutes contained in a column of data type number to a date. e.g.

SELECT my_initial_date + 'xx minute'::INTERVAL as my_date FROM table

What is working is:

SELECT my_initial_date + '7 minute'::INTERVAL as my_date FROM table

This adds 7 minutes to each my_initial_date. What I want to do is the same but with a variable number of minutes stored in another column, e.g.:

SELECT my_initial_date + 'column_name minute'::INTERVAL as my_date FROM table

This doesn't work in CartoDB! How to do this?

1

Thanks to CartoDB support here the correct answer:

SELECT my_initial_date +(column_name::text||' minute')::INTERVAL as my_date FROM tablename
0
Select "DepTime2", "FlightDate" || ' ' || "DepTime2"
,
Select TO_TIMESTAMP('20191001' || ' ' || '18:33','YYYYMMDD HH24:MI') 
from DEP1."FactItinerary"
limit 10;

EXAMPLE:

Select TO_TIMESTAMP('20191001' || ' ' || '18:33','YYYYMMDD HH24:MI') 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.