How to Find the day name of the 2021 new year day from the system?
Hi you can use the DAY NAME function to get the day name of the new year 2021
Query:
SELECT DAYNAME("2021-01-01 12:01:01");
You will get the output as Friday.
Select to_char(to_date('01-01-2020','DD-MM-YYYY'),'DAY') AS DAY from dual;
Assuming that you want to find the day name of January 1, 2021 (New Year's Day) from the current system date, you can use the following SQL query:
SELECT TO_CHAR(TO_DATE('01-JAN-2021', 'DD-MON-YYYY'), 'DAY') AS DAY_NAME
FROM DUAL;
Explanation:
* TO_DATE('01-JAN-2021', 'DD-MON-YYYY') converts the string '01-JAN-2021' into a date value.
* TO_CHAR(<date>, 'DAY') converts the date value into a string that represents the day name (e.g., 'FRIDAY').
* FROM DUAL is required in Oracle to select a constant value.
This query should return the day name of January 1, 2021 from the current system date.