Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7610129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:20:42+00:00 2026-05-31T01:20:42+00:00

I have a (hopefully) quick question. I have two dates stored in a database,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:20:44+00:00Added an answer on May 31, 2026 at 1:20 am

    Are you trying to pull results where the start and end time match? You can do it like this:

    $results = $this->Event->find('all',array('conditions' => 'DATE(Event.start_time) = DATE(Event.end_time)'));
    

    DATE() is a MYSQL function that will just return the date in YYYY-MM-DD format 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() and strtotime() like this:

    if(date('Y-m-d',strtotime($start_date)) == date('Y-m-d',strtotime($end_date))) {
        //dates are equal
    }
    

    where $start_date is ['Event']['start_time'] and $end_date is ['Event']['end_time']

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick (hopefully simple) question. I have some information stored in a
Just a (hopefully) quick question, I have the following HTML code: <tr> <td><img src=img/icons/file_pdf.png></td>
I'm new to Windows servers and I have a hopefully quick question. I am
Hopefully a very quick question. In one of my functions I want to generate
A quick question about the UISegmentedControl class on the iPhone. Hopefully, some may have
I have a quick and hopefully simple question that I hope someone can help
Hopefully this question is quick and painless I have a mvc view where i
I have a (hopefully) quick question. I've got some stepper boxes. Though really this
I have a quick question that hopefully someone has worked through before. In the
I have a hopefully quick question. I have placed an array in a constant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.