-- 1) DATE 타입
SELECT NOW() FROM DUAL;
-- 결과: '2019-07-09 14:20:34'
-- 2) DATE 타입 --> CHAR 타입 변경
SELECT DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') FROM DUAL;
-- 결과: '20190709142515'
SELECT DATE_FORMAT(NOW(), '%m/%d/%Y %H:%i:%s') FROM DUAL;
-- 결과: '07/09/2019 14:24:17'
-- 3) CHAR 타입 --> DATE 타입 변경
SELECT STR_TO_DATE('20190709142515','%Y%m%d%H%i%s') FROM DUAL;
-- 결과: '2019-07-09 14:25:15'
SELECT STR_TO_DATE('07/09/2019 14:24:17','%m/%d/%Y %H:%i:%s') FROM DUAL;
-- 결과: '2019-07-09 14:24:17'
-- 4) 날짜/시간 연산
---- a) 현재 시간
SELECT NOW() FROM DUAL;
-- 결과: '2019-07-09 14:29:51'
---- b) 하루 더하기
SELECT DATE_ADD(NOW(), INTERVAL 1 DAY) FROM DUAL;
-- 결과: '2019-07-10 14:30:10'
---- c) 한시간 더하기
SELECT DATE_ADD(NOW(), INTERVAL 1 DAY_HOUR) FROM DUAL;
-- 결과: '2019-07-09 15:30:49'
---- d) 1분 더하기
SELECT DATE_ADD(NOW(), INTERVAL 1 DAY_MINUTE) FROM DUAL;
-- 결과: '2019-07-09 14:32:40'
---- e) 1초 더하기
SELECT DATE_ADD(NOW(), INTERVAL 1 DAY_SECOND) FROM DUAL;
-- 결과: '2019-07-09 14:32:09'