Mysql _ date increase and decrease problems selectcurdate ();??????????? # Obtain the current date selectlast_day (curdate ());?????????? # Obtain the last day of the current month. SelectDATE_ADD (curdate (), interval-day (curdate () + 1day );? # Obtain selectdate_add (curdate
Mysql _ date increase/decrease problem select curdate ();? ? ? ? ? ? ? ? ? ? ? # Obtain the current date select last_day (curdate ());? ? ? ? ? ? ? ? ? ? # Obtain the last day of the current month. Select DATE_ADD (curdate (), interval-day (curdate () + 1 day );? # Obtain the first day of this month select date_add (curdate
Mysql _ date increase or decrease
Select curdate ();? ? ? ? ? ? ? ? ? ? ? # Getting the current date
Select last_day (curdate ());? ? ? ? ? ? ? ? ? ? # Obtain the last day of the current month.
Select DATE_ADD (curdate (), interval-day (curdate () + 1 day );? # Obtain the first day of the month
Select date_add (curdate ()-day (curdate () + 1, interval 1 month); # obtain the first day of the next month
Select date_add (curdate ()-day (curdate () + 1, interval-1 month); # obtain the first day of the last month
?
However, since the number of days in each month varies from 28/29 to 30 to 31, how can this problem be used? -Day (: stocktime) + 1 to obtain the last month or 1st day of next month may cause problems
As follows:
DATE_ADD (: stocktime, interval-1 month), interval-day (: stocktime) + 1 day)
CONCAT (DATE_FORMAT (DATE_ADD (: stocktime, interval-1 month), '% y-% m'),'-01 ')
Should be changed:
DATE_ADD (: stocktime, interval-day (: stocktime) + 1 day)
CONCAT (DATE_FORMAT (: stocktime, '% y-% m'),'-01 ')