mysql获取当前年月
//1.获取年月日 时分秒 select SYSDATE() AS '年月日 时分秒'; 2020-07-02 16:36:17 //2.获取(年月日) select DATE(CURDATE()) as '年月日'; select CURDATE() as '年月日'; select current_date AS '年月日'; 2020-07-02 //3.获取(时分秒): select time(SYSDATE()) AS '时分秒'; select CURtime() AS '时分秒'; 16:36:17 //4.获取年份 select YEAR(CURDATE()) AS '年'; select YEAR(SYSDATE()) AS '年'; select year(CURRENT_DATE) AS '年' ; 2020 //5.获取月份 select MONTH(CURDATE()) AS '月'; select MONTH(SYSDATE()) AS '月'; select month(CURRENT_DATE) AS '月'; 7 //6.获取日期中的日 select day(CURRENT_DATE) AS '日'; select day(CURDATE) AS '日'; select day(SYSDATE) AS '日'; 3 //7.获取当年一月份 select CONCAT(YEAR(CURDATE()),'-','01'); 2020-07 //8.获取当前系统小时: select HOUR(SYSDATE()) AS '系统小时'; 16 //9.获取当前系统分钟: select MINUTE(SYSDATE()) AS '系统分钟'; 36 //10.获取当前系统秒: select SECOND(SYSDATE()) AS '系统秒'; 17 //11.获取当前系统毫秒: select MICROSECOND(SYSDATE()) AS '系统毫秒'; 0