I have following
$var = \"2010-01-21 00:00:00.0\"
I\'d like to compare this date against today\'s date (i.e. I\'d like to know if this
Few years later, I second Bobby Jack's observation that last 24 hrs is not today!!! And I am surprised that the answer was so much upvoted...
To compare if a certain date is less, equal or greater than another, first you need to turn them "down" to beginning of the day. In other words, make sure that you're talking about same 00:00:00 time in both dates. This can be simply and elegantly done as:
strtotime("today") <=> strtotime($var)
if $var
has the time part on 00:00:00 like the OP specified.
Replace <=>
with whatever you need (or keep it like this in php 7)
Also, obviously, we're talking about same timezone for both. For list of supported TimeZones