MySQL_Workbench

MySQL 날짜와 시간 처리 curdate, curtime, now...

K2ODING 2021. 12. 8. 17:46
728x90

people2 테이블

select name, day(birthdate) from people2; -- birthdate 일에대한 정보 

select name, dayname(birthdate) form people2 -- 요일 정보 

select name, month(birthdate) from people2; -- 달 정보

select name, hour(birthtime) from people2; -- birthtime 시간 정보

select name, minute(birthtime) from people2; -- 분
-- 현재 날짜를 화면에 출력하세요.
select curdate();

-- 현재의 요일을 화면에 출력하세요.
select dayname( curdate() ); -- 무슨 요일 

-- 현재 날짜를 월/일/년도 로 화면에 출력하세요
select date_format(curdate(), '%m/%d/%Y');