Oracle Datetime Functions
This page summarizes common date and time functions in Oracle.
Date and time functions operate on dates (DATE), timestamps (TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE), and interval (INTERVAL DAY TO SECOND, INTERVAL YEAR TO MONTH) values.
-
ADD_MONTHS
Learn Oracle ADD_MONTHS(date, integer), including month-end adjustment, negative offsets, NLS_CALENDAR, and its DATE return type. -
CURRENT_DATE
OracleCURRENT_DATEis a built-in function that returns the current date in the current session time zone as a value of theDATEdata type in the Gregorian calendar. -
CURRENT_TIMESTAMP
OracleCURRENT_TIMESTAMP()is a built-in function that returns the current date and time in the current session time zone, as a value of theTIMESTAMP WITH TIME ZONEdata type. -
DBTIMEZONE
OracleDBTIMEZONEis a built-in function that returns the value of the database timezone. -
EXTRACT(datetime)
OracleEXTRACT(datetime)is a built-in function that extracts and returns the value of the specified date field from a datetime or interval expression. -
FROM_TZ
Oracle FROM_TZ attaches a time zone to a TIMESTAMP and returns TIMESTAMP WITH TIME ZONE. See offset, region, NULL, DST, and conversion examples. -
LAST_DAY
OracleLAST_DAY()is a built-in function that returns the last day of the month for a given date. -
LOCALTIMESTAMP
OracleLOCALTIMESTAMP()is a built-in function that returns the current date and time in the current session time zone as aTIMESTAMPdata type. -
MONTHS_BETWEEN
The OracleMONTHS_BETWEEN()is a built-in function that returns the number of months between two given dates. -
NEW_TIME
OracleNEW_TIME()is a built-in function that converts a date from one specified time zone to another specified time zone and returns the result. -
NEXT_DAY
OracleNEXT_DAY()is a built-in function that returns the date of the specified first workday that occurs after a given date. -
ORA_DST_AFFECTED
OracleORA_DST_AFFECTED()is a built-in function that checks whether the given datetime expression is affected by the modification of the time zone file. -
ORA_DST_CONVERT
OracleORA_DST_CONVERT()is a built-in function that converts a given date-time expression when modifying time zone files and allows you to specify how to handle errors. -
ORA_DST_ERROR
OracleORA_DST_ERROR()is a built-in function that returns a number indicating whether the given date-time value would cause errors with the new time zone data. -
ROUND(date)
OracleROUND(date)is a built-in function that rounds the given date to the specified unit. -
SESSIONTIMEZONE
OracleSESSIONTIMEZONE()is a built-in function that returns the value of the time zone for the current session. -
SYS_EXTRACT_UTC
Oracle SYS_EXTRACT_UTC converts a datetime value to UTC. Learn its TIMESTAMP return type, session time-zone behavior, and practical examples. -
SYSDATE
OracleSYSDATEis a built-in function that returns the current date and time as set in the operating system of the database server. -
SYSTIMESTAMP
OracleSYSTIMESTAMPis a built-in function that returns the current date and time, including fractional seconds and time zone, as set by the operating system on the database server. -
TRUNC(DATE)
Learn Oracle TRUNC(datetime) for removing time, finding month or year starts, truncating ISO weeks, handling TIMESTAMP inputs, and filtering dates efficiently. -
TZ_OFFSET
OracleTZ_OFFSET()is a built-in function that returns the time zone offset corresponding to the provided parameter, based on the date of the statement execution.