简体   繁体   中英

How do i check a date value falls with in a date range last month

How do i check a date value falls with in a date range of last month using PHP ?

For example : 2015-09-12 is a date in last Month. But 2015-08-15 is not .

Thanks, Sumesh

Try this -

date('mm', strtotime('2015-09-12')) === date('mm', strtotime(' - 1 MONTH'));

Will be true if date falls in last month else false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM