오라클의 기본값
DD - Mon - RR ( 13 - april - 10) // Sysdate(현째날짜만)
Mysql 의 기본값
yyyy-mm-dd (2010-04-13) // now (현재날짜에 시분초까지) , curdate (시분초는 제외)
Date Format
select DATE_FORMAT(hiredate, '%M %d, %Y') from emp
## 날짜 포맺형식을 제공
%Y : Four-digit year %y : Two-digit year
%M : complete month name %b : month name, initial three letters
%m : Two-digit month of year (01 ?12)
%c : month of year (1 ?12)
%d : Two-digit day of month (01 ?31)
%e : Day of month (1 ?31)
## 여기서 부터는 시간을 포맺
%r : 12-hour time with AM or PM suffix
%T : 24-hour time
%H : Two-digit hour
%i : Two-digit minute
%s : Two-digit second
%% : literal %
DATE Function
select YEAR(hiredate), DAYNAME(hiredate) from emp
YEAR()
MONTH()
MONTHNAME()
DAYOFMONTH()
DAYNAME()
DAYOFWEEK()
WEEKDAY()
DAYOFYEAR()
HOUR()
MINUTE()
SECOND()
/*
## 이번달에 입사한 사원을 알아보자.
select ename , hiredate from emp
where month(hiredate) = month(curdate());
*/
/*
## 올해 그리고 이번달에 입사한 사원을 알아보자
select ename , hiredate from emp
where year(hiredate) = year(curdate()) &&
month(hiredate) = month(curdate());
*/