This tutorial page is based on examples to make it easier to follow. Oracle Date Format types are on this link. The most basic way to use a date format is as the next example:
SELECT TO_DATE('20120921','YYYYMMDD') FROM DUAL;
In the example above the Oracle date format has declared a date mask after string ‘20120921‘. The oracle date mask is a text that is formatted in the same way and in order that is the data value. In this Oracle database management system example the year is as “YYYY” + month as “MM” + day number as “DD”. The oracle query returns the oracle date value of September 21st 2012.
To find the last day of any year, our recommends to do it the following way. For example in the oracle date format we would like to get the last day number of year 2000.
SELECT TO_DATE('20010101','YYYYMMDD') -1 FROM DUAL;
The example above is using the 1st of January 2001 and subtract 1 day of it. The same way you can find last day of February month. It can be different by every 4th year and to use the following example it can be archived easily. In the next example with date format in Oracle and we will need to find the last day of February 1998.
SELECT TO_DATE('19980301','YYYYMMDD') -1 FROM DUAL;
In the last example above we took the next month’s first day (March 1st 1998) and subtract 1 day of it.