Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I a convert a number to an INTERVAL of minutes?

In pseudo-Oracle, I want to do the following:

select systimestamp + to_interval(select NUMERIC_COLUMN from SOME_TABLE where SOME_TABLE_PK = :stuff) from dual;

If the number of minutes were always the same, I could use an interval literal a la interval '360' minute, but I can't find a simple function to convert a number to a MINUTE interval. What am I missing?

like image 653
Hank Gay Avatar asked Aug 22 '11 14:08

Hank Gay


People also ask

How do you convert hours and minutes to minutes in Excel?

To convert hours and minutes to a numeric number of Minutes: 1. Ensure the time to be converted is in the custom format hh:mm. 2. Ensure the cells where the answer is to be are formatted as a Number with 0 decimal points 3. In the cell where you want the answer enter the time cell number*1440 e.g =a2*1440

How to convert a number to time values?

If you want to convert a number to time values, you need some additional operations, multiplying and dividing between days, hours, minutes, and seconds.

How to convert hours from one Standard Time format to others?

Excel stores Date and Time in number format. To convert hours from one standard time format to others, we can use the CONVERT Function. CONVERT function converts a number from one measurement system to another.

How do I convert time to a decimal in Excel?

Ensure the time to be converted is in the custom format hh:mm. 2. Ensure the cells where the answer is to be are formatted as a Number with 0 decimal points 3. In the cell where you want the answer enter the time cell number*1440 e.g =a2*1440 4.


1 Answers

You can use the numtodsinterval function which does exactly the conversion you need (number to interval):

SQL> select systimestamp, systimestamp + numtodsinterval(20, 'MINUTE') from dual;

SYSTIMESTAMP              SYSTIMESTAMP+NUMTODSINTERVAL(2
------------------------- -------------------------------
2011-08-22 16:12:24.060   2011-08-22 16:32:24.060
like image 196
Vincent Malgrat Avatar answered Oct 24 '22 20:10

Vincent Malgrat