Oracle Datetime | Date & Time Function - oracle tutorial - sql tutorial
What is Oracle Date Time Function ?
- The Oracle/PLSQL CURRENT_DATE and CURRENT_TIMESTAMP function Returns the current date and time in the time zone of the current SQL session as set by the ALTER SESSION command.
Syntax:
Example:
- Alter Session Set TIME_ZONE is used to set your time zone value for identifying your actual time.
Example:
- Current_Date from dual statement Returns the current date.
Time Function:
- The Oracle/PLSQL CURRENT_TIMESTAMP function returns the current date and time in the time zone of the current SQL session as set by the ALTER SESSION command. It returns a TIMESTAMP WITH TIME ZONE value.
- Similarly we can find the current time using CURRENT_TIMESTAMP keyword.
oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , plsql
Other Date and Time Function:
- ADD_MONTHS - Returns a date with a specified number of months added.
- LOCALTIMESTAMP - Returns the current date and time in the time zone
- SESSIONTIMEZONE - Returns the current session's time zone as a time zone offset
- MONTHS_BETWEEN - Returns the number of months between date1 and date2.
- SYSDATE - Returns the current system date and time on your local database.
- NEW_TIME - Converts a date from time zone1 to a date in time zone2.
- NEXT_DAY - Returns the first weekday that is greater than a date
- TRUNC(dates) - Returns a date truncated to a specific unit of measure.