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 631747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:00:00+00:00 2026-05-13T20:00:00+00:00

I am trying to make an availability calendar and need to know how can

  • 0

I am trying to make an availability calendar and need to know how can I compare dates when fetching it.

My DB is

id
start_date
end_date
status

Now suppose I want to fetch booking in next the month, i.e. from 2010-03-01 to 2010-04-01. How should I fetch this data? I did try comparing directly using an and condition but it didn’t help.

The format in the DB is yyyy-mm-dd and I used the same to compare. But direct comparison does not work.

  • 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-13T20:00:00+00:00Added an answer on May 13, 2026 at 8:00 pm

    How to fetch date ranges that intersect with another range is expertly explained here: Comparing date ranges

    In summary, you probably want to query for something like this:

    $start = date('Y-m-d');
    $end = date('Y-m-d', strtotime('+1 month'));
    
    $conditions = array('Event.start <=' => $end, 'Event.end >=' => $start);
    
    $this->Event->find('all', array('conditions' => $conditions));
    

    This will find all events within the next month. They may start earlier or end later, but they’ll intersect with the month.

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

Sidebar

Related Questions

trying to make 5 curl childs for curl handler and defining them, but can't
I'm trying to make sense of the RadWindow/RadWindowManager relation. I see that there can
I´m trying to make something similar to the downloads panel of Transmission BT (here
Im trying to make a a query, but its doubling the Sum values SELECT
im trying to make an easy drop down menu plugin for jquery but for
I am trying to make sense of handling regular expression with php. So far
So I'm trying to make my android app build a bitmap to the size
I am trying to make use of the JavaMail jar on my blackberry app
I am trying to make a application in java which connects to a mysql
I have 3 pdf file for 1 chapter like pdf_chapter_1_page_1.pdf,pdf_chapter_1_page_2.pdf,pdf_chapter_1_page_3.pdf. In first chapter we

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.