[MariaDB] 날짜 관련 명령어 now() 현재 날짜 및 시간 정보 출력 / sysdate(), current_timestamp() 현재 날짜 및 시간 정보 출력 / curdate(), curtime() 시간 정보 출력 / 현재 날짜에 2일 더하기 date_add( 기준 날짜,..
by bkuk2022. 10. 20.
now(), 현재 날짜 및 시간 정보 출력
selectnow();
sysdate(), current_timestamp(), 현재 날짜 및 시간 정보 출력
selectsysdate(), current_timestamp();
curdate(), curtime(), 시간 정보 출력
selectcurdate(), curtime();
현재 날짜에 2일(2 day) 더하기( date_add == adddate )
selectnow(), date_add( now(), interval2day );
현재 날짜에 2달(2 month) 더하기( date_add == adddate )
selectnow(), date_add( now(), interval2month );
현재 날짜에 2달 빼기( date_sub == subdate )
selectnow(), date_sub( now(), interval2month );
yearI( 날짜 정보 ), 연도 출력
selectyear( now() );
연도 출력하기 응용 1
select hiredate, year( hiredate ) from emp where deptno =10;