9. Date Manipulation
Determining Whether a Year Is a Leap Year
select to_char(
last_day(add_months(trunc(sysdate,'y'),1)),
'DD')
from t1Determining the Number of Days in a Year
select add_months(trunc(sysdate,'y'),12) - trunc(sysdate,'y') from dualExtracting Units of Time from a Date
select to_number(to_char(sysdate,'hh24')) hour,
to_number(to_char(sysdate,'mi')) min,
to_number(to_char(sysdate,'ss')) sec,
to_number(to_char(sysdate,'dd')) day,
to_number(to_char(sysdate,'mm')) mth,
to_number(to_char(sysdate,'yyyy')) year
from dualDetermining the First and Last Days of a Month
Determining All Dates for a Particular Weekday Throughout a Year
Determining the Date of the First and Last Occurrences of a Specific Weekday in a Month
Creating a Calendar

Listing Quarter Start and End Dates for the Year

Determining Quarter Start and End Dates for a Given Quarter

Searching on Specific Units of Time
Comparing Records Using Specific Parts of a Date
Identifying Overlapping Date Ranges
Last updated