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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:10:032300browse
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; --获取当前月的天数

Statement:
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