-- Obtain the select TRUNC (SYSDATE) FROM dual; -- Obtain the 23: 59 minutes and 59 seconds of the current day (add one day and then minus one second based on the 00:00:00 of the current day) select trunc (SYSDATE) + 1-1/86400 FROM dual; -- 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; -- in oracle, how do I obtain the first and last DAY of the month of the current DAY select to_char (sysdate, 'yyyy-mm') | '-01' firstday, to_char (last_day (sysdate), 'yyyy-mm-dd') lastday from dual -- implement data before that day minus yesterday, after minus today select field1, field2 from mytablewhere time = decode (sign (sysdate-trunc (sysdate)-16/24), -- time judgment-1, trunc (sysdate) -1 + 16/24, -- get trunc (sysdate) + 16/24 at yesterday -- get 16 at on the same day
Related reading: Oracle's TO_DATE and TO_CHAR Functions