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
OracleADD_MONTHS()
is a built-in function used to add or subtract a specified number of months to a given date. -
CURRENT_DATE
OracleCURRENT_DATE
is a built-in function that returns the current date in the current session time zone as a value of theDATE
data 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 ZONE
data type. -
DBTIMEZONE
OracleDBTIMEZONE
is 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
OracleFROM_TZ()
is a built-in function that converts a timestamp value and a time zone value into a timestamp value with time zone. -
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 aTIMESTAMP
data 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
OracleSYS_EXTRACT_UTC()
is a built-in function that extracts the UTC from a datetime value with a time zone offset or time zone name. -
SYSDATE
OracleSYSDATE
is a built-in function that returns the current date and time as set in the operating system of the database server. -
SYSTIMESTAMP
OracleSYSTIMESTAMP
is 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)
OracleTRUNC(date)
is a built-in function that truncates a given date to the specified unit. -
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.