DB/ORACLE
[Oracle]ROUND(date)
yeon.Biju
2020. 6. 10. 14:14
오라클 ROUND(date)
ROUND(date)
-
ROUND(date)
ROUND(date, fmt)
의 형태
ROUND returns date rounded to the unit specified by the format model fmt. The function is not sensitive to the NLS_CALENDAR session parameter. It operates according to the rules of the Gregorian calendar. The value returned is always of data type DATA, even if you specify a different datetime data type for date. If you moit fmt, then date is rounded to the nearest day. The date expression must resolve to a DATE value.
SQL > SELECT ROUND(TO_DATE('2020-05-01', 'YYYY-MM-DD'), 'YEAR') FROM DUAL ;
--> 2020/01/01
SQL> SELECT ROUND(TO_DATE('2020-05-22', 'YYYY-MM-DD'), 'MONTH') FROM DUAL ;
--> 2020/06/01