1: Obtain the start time and end time of the week.
SQL> SELECT TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss'), 'D') + 1 ASA FROM DUAL;
A
-----------
SQL> SELECT TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss'), 'D') + 7 ASA FROM DUAL;
A
-----------
2013/12/1
2. Set the start time and end time of the month.
SQL> SELECT TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss'), 'mm') AS AFROM DUAL;
A
-----------
SQL> SELECT LAST_DAY (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss') AS AFROM DUAL;
A
-----------
3. Set the start time and end time of the season.
SQL> SELECT TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss'), 'q') AS AFROM DUAL;
A
-----------
2013/10/1
SQL> SELECT ADD_MONTHS (TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DDHH24: MI: ss'), 'q'), 3) -1 as a from dual;
A
-----------
4. Set the start time and end time of the year.
SQL> SELECT TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DD HH24: MI: ss'), 'yyyy') ASA FROM DUAL;
A
-----------
2013/1/1
SQL> SELECT ADD_MONTHS (TRUNC (TO_DATE ('2017-11-25 10:31:11 ', 'yyyy-MM-DDHH24: MI: ss'), 'yyyy'), 12) -1 as a from dual;
A
-----------
March 31