All Products
Search
Document Center

TO_DSINTERVAL

Last Updated: Jun 18, 2021

The TO_DSINTERVAL function converts a string of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type to a value of the INTERVAL DAY TO SECOND data type. You can use this function to add or subtract a date and time value.

Syntax

TO_DSINTERVAL (days hours:minutes:seconds[.frac_secs])

Parameters

Parameter

Description

days hours:minutes:seconds[.frac_secs]

The string of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type in compliance with the format of this parameter.

Return type

INTERVAL DAY TO SECOND data type

Examples

The following example returns a date and time value 100 days later than the current time:

SELECT SYSDATE, SYSDATE+TO_DSINTERVAL('100 00:00:00') FROM DUAL;

The following query result is returned:

+---------------------+--------------------------------------+
| SYSDATE             | SYSDATE+TO_DSINTERVAL('10000:00:00') |
+---------------------+--------------------------------------+
| 2020-03-26 12:40:39 | 2020-07-04 12:40:39                  |
+---------------------+--------------------------------------+