For example: select to_date (' 2018 ', 'yyyy) from dual
Result: 20180601
CodePudding user response:
Official document writing ithttps://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF0021
The default date values are determined as follows:
The year is The current year, as returned by SYSDATE.
The month is The current month, as returned by SYSDATE.
The day is 01 (The first day of The month).
The hour, minute, and second are all 0.
If you want to January 1, use the
The select trunc (to_date (' 2018 ', 'yyyy'), 'y') from dual;