1. Get selectTRUNC (SYSDATE) FROMdual at 00:00:00 of the current day; 2. Get 23: 59: 59 seconds of the current day (add 1 day based on 00:00:00 of the current day and then minus 1 second) SEL
1. Get select TRUNC (SYSDATE) FROM dual; 2. Get 23: 59: 59 seconds on the current day (add 1 day after 00:00:00 on the current day and then subtract 1 second) SEL
1. Get 00:00:00 of the current day
Select TRUNC (SYSDATE) FROM dual;
2. Get 23: 59: 59 seconds on the current day (add one day and then minus one second on the basis of 00:00:00 on the current day)
Select trunc (SYSDATE) + 1-1/86400 FROM dual;
3. The current date is the day of the week. Note: Sunday is the first day of the week.
Select to_char (sysdate, 'D'), to_char (sysdate, 'day') from dual;
4. How to get the first and last days of the month in Oracle
Select to_char (sysdate, 'yyyy-mm') | '-01' firstday, to_char (last_day (sysdate), 'yyyy-mm-dd') lastday from dual
5. Implement the data before of the current day minus of the previous day, after minus of the current day
Select field1, field2 from mytablewhere time = decode (sign (sysdate-trunc (sysdate)-16/24), -- time judgment
-1, trunc (sysdate)-1 + 16/24, -- less than 16 points to get yesterday
Trunc (sysdate) + 16/24) -- value greater than 16 points for the current day
,