日付の切り捨て・切り上げDATE()を使う方法mysql> SELECT DATE(NOW()); +-------------+ | DATE(NOW()) | +-------------+ | 2019-06-07 | +-------------+ DATE_FORMAT()を使う方法mysql> SELECT DATE_FORMAT(NOW(), ' %Y-%m-01'); +--------------------------------+ | DATE_FORMAT(NOW(), '%Y-%m-01') | +--------------------------------+ | 2019-06-01 | +--------------------------------+ 参考 |
|