Using Datetime Functions : Introduction « Date Timestamp Functions « Oracle PL/SQL Tutorial






In the following table, x represents a datetime or a timestamp.

FunctionDescription
ADD_MONTHS(x, y)Add y months to x. If y is negative, y months are subtracted from x.
LAST_DAY(x)Get the last day of the month.
MONTHS_BETWEEN(x, y)Returns the number of months between x and y. If x appears before y on the calendar, the number returned is positive.
NEXT_DAY(x, day)Returns the datetime of the next day following x; day is specified as a literal string, for example SATURDAY.
NEW_TIMEReturns the time/day value from a time zone specified by the user.
ROUND(x [, unit])Rounds x. By default, x is rounded to the beginning of the nearest day. You may supply an optional unit string to indicate the rounding unit.
SYSDATE()Returns the current datetime set for the operating system.
TRUNC(x [, unit])Truncates x. By default, x is truncated to the beginning of the day. You may supply an optional unit string that indicates the truncating unit.










13.1.Introduction
13.1.1.Using Datetime Functions
13.1.2.Timestamp-Related Functions
13.1.3.Time Interval Related Functions
13.1.4.Date Functions
13.1.5.LAST_DAY, TO_CHAR, TO_DATE
13.1.6.select date '1954-08-11' + 10000 as 10,000 days
13.1.7.Differences Between Dates