mysql get first and last day of the month

mysql get first and last day of the month


mysql> select SUBDATE('2009-08-20',DAYOFMONTH('2009-08-20')-1),DAYOFMONTH('2009-08-20'),LAST_DAY('2009-08-20') from dual;
+--------------------------------------------------+--------------------------+------------------------+
| SUBDATE('2009-08-20',DAYOFMONTH('2009-08-20')-1) | DAYOFMONTH('2009-08-20') | LAST_DAY('2009-08-20') |
+--------------------------------------------------+--------------------------+------------------------+
| 2009-08-01 | 20 | 2009-08-31 |
+--------------------------------------------------+--------------------------+------------------------+
1 row in set (0.00 sec)

Comments

Popular posts from this blog

Vim vi how to reload a file your editing