mysql: first and last days of months

This entry was posted by on Tuesday, 3 April, 2012 at

SELECT
  date_sub(CURDATE(), INTERVAL DAYOFMONTH(CURDATE()) -1 day) FIRST_DAY_OF_MONTH,
  last_day( CURDATE() ) LAST_DAY_OF_MONTH ,
  date_add(date_sub(CURDATE(), INTERVAL DAYOFMONTH(CURDATE()) -1 day), interval 1 month) FIRST_DAY_OF_NEXT_MONTH


Leave a Reply