Sk_
Sk_

Reputation: 1191

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

Upvotes: 0

Views: 46

Answers (1)

Sougata Bose
Sougata Bose

Reputation: 31749

Try this -

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

Will be true if date falls in last month else false

Upvotes: 1

Related Questions