

Select to_char(to_date('1','dd-mon-yyyy'),'Day')from dual Users need to see what was the day on at that time we can use the following statement as follows. The end output of the above query we illustrate by using the following snapshot. In the above statement, we use alter session command to change the date format as per our requirement as shown in above statement. Suppose users need to display date and time in DD – MONTH – YYYY format at that time we can use the following statement as follows.Īlter session set NLS_DATE_FORMAT=’DD-MONTH-YYYY HH:MIpm’ Now we can check the date by using the following statement. In the above statement, we use the alter session command to change the date format as per our requirement as shown in the above statement.

The formats of date is depending on NLS_DATE_FORMAT parameter and suppose we need to display date and time in date – month – yy format at that time we can use the following statement as follows.Īlter session set NLS_DATE_FORMAT='DD-MONTH-YY HH: MIpm' In the above example, we use the select sysdate function to check system current date, here dual is a table name that is automatically created by oracle database with data directory and it is accessible to all users. At that time we use the following statement as follows. Suppose we need to see current system data. Now let’s see a different example of date format as follows. YY: By using this format we can display the last two digits of year for example 21.YYYY: This four Y is used to display the year for example 2020.DY: This format is used to display the name of the day for example SUN.DD: This is used to display the day of the month for example 21.MONTH: By using this format we can display the full name of month for example JUN.MON: This format is used to display month with a name for example JAN.MM: It is used to display month in numeric format for example: 05.General uses of TO_CHAR function as follows. SYSTIMESTAMP: This function returns the current date and time of the system with fractional seconds.SYSDATE: it also used to return the current date of system.CURRENT_DATE: this function is used to display the current date in our system with current time zone.System date uses the following data function as follows.
