Date Arithmetic Functions

Contact Us or call 1-877-932-8228
Date Arithmetic Functions

Date Arithmetic Functions

Dates can be modified by using the + and - operators. Several functions can be used to read and manipulate dates as well. The MONTHS_BETWEEN function returns a number representing the number of months between two dates. The NEXT_DAY returns the first day after the date in the first argument that is the day of the week specified in the second argument. The ADD_MONTHS function returns the date specified in the first argument incremented by the number of days specified in the second argument. Dates can be rounded or truncated using ROUND and TRUNC. There are also various functions relate to timestamps.

Code Sample:

	hire_date + 1,
	add_months(hire_date, 2)
FROM employees 
WHERE last_name LIKE 'K%';

This example shows several different ways to return a date based upon the employee hire date (+ operationr, NEXT_DAY and ADD_MONTHS functions).