Useful Sysdate Formats and Queries
Sysdate Formats and Commands
The following table lists some useful sysdate formats for use in SQL
Time Interval | Format |
---|---|
Now | sysdate |
Tomorrow/Next Day | sysdate + 1 |
Seven Days from Now | sysdate + 7 |
One Hour from Now | sysdate + 1/24 |
Three Hours from Now | sysdate + 3/24 |
Half an Hour from Now | sysdate + 1/48 |
Ten Minutes from Now | sysdate + 10/1440 |
Thirty Seconds from Now | sysdate + 30/86400 |
Tomorrow at 12 Midnight | trunc(sysdate + 1) |
Tomorrow at 8am | trunc(sysdate + 1) + 8/24 |
Next Monday at 12 Noon | next_day(trunc(sysdate), 'MONDAY') + 12/24 |
First Day of the Month at 12 Midnight | trunc(last_day(sysdate) + 1) |
The Nex Monday, Wednesday or Friday at 9am | trunc(least(next_day(sysdate,''MONDAY''),next_day(sysdate,''WEDNESDAY''),next_day(sysdate,''FRIDAY''))) + (9/24) |
Date Queries
- Show the First Day of the Month
- Show the Last Day of the Month
- Show the Number of Days in this Month
- Show the Remaining Days this Month
- Show the First Day of the Year
- Show the Number of Seconds So Far Today
- Show the Number of Seconds Left Today
- Show the Start Date and End Date of the Month
- Show Number of Months Between Two Dates
- Show the Last Day of the Year