使用例:
SELECT HOUR(CURRENT_TIMESTAMP(6));
SELECT MINUTE(CURTIME());
SELECT SECOND('12:34:25');
sel dayofmonth(current_timestamp); sel dayofmonth(date '2017-08-21'); sel dayofmonth(timestamp '2017-08-21 16:48:27.770000+00:00'); sel dayofmonth('2017-08-21 16:48:27.770000+00:00' (timestamp)); sel dayofmonth(date '1900-01-01'); sel dayofmonth(date '2018-02-22' - interval '300' year); sel dayofmonth(date '2018-02-22' - interval '6' month); sel dayofmonth(date '2018-02-22' - interval '15' day);
sel week(date); sel week(current_date); sel week(date '1900-01-01'); sel week(date '1700-05-31'); sel week(date - interval '300' year); sel week(date - interval '6' month); sel week(date - interval '150' day);
sel month(date); sel month(current_date); sel month(date '1900-01-01'); sel month(date '1899-12-31'); sel month(date '1700-05-31'); sel month(date - interval '300' year); sel month(date - interval '6' month); sel month(date - interval '150' day);
sel year(date); sel year(current_date); sel year(date '1900-01-01'); sel yearmonth(date '1899-12-31'); sel year(date - interval '300' year); sel year(date - interval '6' month);