DATEDIFF_IN_DAYS() SQL Function

Previous Next

DATEDIFF_IN_DAYS (timestamp1, timestamp2) gives the difference in days between two timestamps. If at least one of the arguments contains time values, the function will deliver float values. To prevent this, use the TIMESTAMP_TO_DATE function to convert the argument(s) to a format that does not contain time information. For example:

SELECT DATEDIFF_IN_DAYS(TIMESTAMP_TO_DATE(SYSDATE), TIMESTAMP_TO_DATE(<timestamp_field>))