I have a (hopefully) quick question. I have two dates stored in a database, [‘Event][‘start_time’] and [‘Event’][‘end_time’]. I want to compare the dates to see if they match based on day, month, and year, disregarding the hours, minutes, and seconds they were created. How do I pick out the details of my dates when they’re in this format?
Share
Are you trying to pull results where the start and end time match? You can do it like this:
DATE()is a MYSQL function that will just return the date inYYYY-MM-DDformat and drop the time portion.If you already have the data selected and want to compare it later, you can use the php functions
date()andstrtotime()like this:where
$start_dateis['Event']['start_time']and$end_dateis['Event']['end_time']