5/6/2019 Oracle Date Functions
HOME START HERE BASIC ADVANCED FUNCTIONS PL/SQL
Home / Oracle Date Functions
Oracle Date Functions
This page provides you with the most commonly used Oracle date functions that help you handle date
and time data easily and more e湺ectively.
Type a function name to search...
Function Example Result Description
ADD_MONTHS ADD_MONTHS( DATE '2016‐ 31‐MAR‐16 Add a number of
02‐29', 1 ) months (n) to a date
and return the same
day which is n of
months away.
CURRENT_DATE SELECT CURRENT_DATE FROM 06‐AUG‐2017 Return the current date
dual 19:43:44 and time in the session
time zone
CURRENT_TIMESTAMP SELECT CURRENT_TIMESTAMP 06‐AUG‐17 Return the current date
FROM dual 08.26.52.742000000 and time with time
PM ‐07:00 zone in the session
time zone
DBTIMEZONE SELECT DBTIMEZONE FROM ‐07:00 Get the current
dual; database time zone
EXTRACT EXTRACT(YEAR FROM 2017 Extract a value of a date
SYSDATE) time eld e.g., YEAR,
MONTH, DAY, … from a
date time value.
http://www.oracletutorial.com/oracledatefunctions/ 1/5
5/6/2019 Oracle Date Functions
Function Example Result Description
FROM_TZ FROM_TZ(TIMESTAMP '2017‐ 08‐AUG‐17 Convert a timestamp
08‐08 08:09:10',
HOME START HERE 08.09.10.000000000
BASIC ADVANCED and a time zone
FUNCTIONS toPL/SQL
a
'‐09:00') AM ‐07:00 TIMESTAMP WITH TIME
ZONE value
LAST_DAY LAST_DAY(DATE '2016‐02‐ 29‐FEB‐16 Gets the last day of the
01') month of a specied
date.
LOCALTIMESTAMP SELECT LOCALTIMESTAMP 06‐AUG‐17 Return a TIMESTAMP
FROM dual 08.26.52.742000000 value that represents
PM the current date and
time in the session time
zone.
MONTHS_BETWEEN MONTHS_BETWEEN( DATE 6 Return the number of
'2017‐07‐01', DATE '2017‐ months between two
01‐01' ) dates.
NEW_TIME NEW_TIME( TO_DATE( '08‐ 06‐AUG‐2017 Convert a date in one
07‐2017 01:30:45', 'MM‐ 21:30:45 time zone to another
DD‐YYYY HH24:MI:SS' ),
'AST', 'PST' )
NEXT_DAY NEXT_DAY( DATE '2000‐01‐ 02‐JAN‐00 Get the rst weekday
01', 'SUNDAY' ) that is later than a
specied date.
ROUND ROUND(DATE '2017‐07‐16', 01‐AUG‐17 Return a date rounded
'MM') to a specic unit of
measure.
SESSIONTIMEZONE SELECT SESSIONTIMEZONE ‐07:00 Get the session time
FROM dual; zone
http://www.oracletutorial.com/oracledatefunctions/ 2/5
5/6/2019 Oracle Date Functions
Function Example Result Description
SYSDATE SYSDATE 01‐AUG‐17 Return the current
HOME START HERE BASIC ADVANCED system dateand time
FUNCTIONS PL/SQL
of the operating system
where the Oracle
Database resides.
SYSTIMESTAMP SELECT SYSTIMESTAMP FROM 01‐AUG‐17 Return the system date
dual; 01.33.57.929000000 and time that includes
PM ‐07:00 fractional seconds and
time zone.
TO_CHAR TO_CHAR( DATE'2017‐01‐ Sunday, January Convert a DATE or an
01', 'DL' ) 01, 2017 INTERVAL value to a
character string in a
specied format.
TO_DATE TO_DATE( '01 Jan 2017', 01‐JAN‐17 Convert a date which
'DD MON YYYY' ) is in the character
string to a DATE value.
TRUNC TRUNC(DATE '2017‐07‐16', 01‐JUL‐17 Return a date truncated
'MM') to a specic unit of
measure.
TZ_OFFSET TZ_OFFSET( +01:00 Get time zone o湺set of
'Europe/London' ) a time zone name from
UTC
Was this tutorial helpful? yes no
« Previous Tutorial:
Oracle Analytic Functions
Next Tutorial:
Oracle String Functions »
http://www.oracletutorial.com/oracledatefunctions/ 3/5