Home > Database > Mysql Tutorial > mysql日期 获取本月第一天 获取下个月的第一天_MySQL

mysql日期 获取本月第一天 获取下个月的第一天_MySQL

WBOY
Release: 2016-06-01 13:10:03
Original
2285 people have browsed it
select curdate();                       --获取当前日期select last_day(curdate());                    --获取当月最后一天。select DATE_ADD(curdate(),interval -day(curdate())+1 day);   --获取本月第一天select date_add(curdate()-day(curdate())+1,interval 1 month); -- 获取下个月的第一天select DATEDIFF(date_add(curdate()-day(curdate())+1,interval 1 month ),DATE_ADD(curdate(),interval -day(curdate())+1 day)) from dual; --获取当前月的天数
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template