Generic filters
Exact matches only

Compare Year and Month date only in PHP

7th August 2019

Php - Dates & Time

php codehaven

This was a difficult one to get right, comparing the Month and Year only was full of surprises.
My variable $joined was “2019-12-01 00:00:00”
and my Month was “Jul” and my Year was “2019”
Just cut and paste and your done!

Was this code snippet helpful?