date - Find Last Day of Last Year in MySQL -
i know how find (current) year's last day in mysql.
select last_day(date_add(now(), interval 12-month(now()) month)); //it shows year (2017)'s last day. ==> 2017-12-31
but not know how find last year's last day.
what queries should enter determine last year last day?
for example:
++++this year++++ | ++++last year's last day++++ 2017 | 2016-12-31 2018 | 2017-12-31 2019 | 2018-12-31 2020 | 2019-12-31
thanks help, appreciated.
just subtract 1 year:
select date_sub(last_day(date_add(now(), interval 12-month(now()) month)), interval 1 year)
Comments
Post a Comment