Filtering dates

Hi,

I’m having some records with a start- and end-date:

  1. start= 01/03/2007 end 05/05/2007
  2. start= 01/04/2007 end 20/06/2007
  3. start= 15/07/2007 end 01/08/2007

How can I query the records that lie in a specific month?

I need for example all records that occur in the month may (05).

So if a record starts on 01/03/2007 and ends on 05/05/2007 => it lies in
the month may

But the 2nd record also lies in the month may! It starts on 01/04/07 and
ends on 20/06/07

The third record doesn’t occur in the month may

Any help would be welcome :). It looks simple, but it’s driving me nuts

Thanks

Maarten P. wrote:

I need for example all records that occur in the month may (05).

Thanks

something like: start_date <= end_of_may and end_date >= start_of_may?
sorry for the lack of code - it’s 3:30AM and my brain’s left for the
night!

Cheers,
Mohit.
9/26/2007 | 3:28 AM.

jezus … I feel stupid :slight_smile: Works great… Thanks a lot!

Maarten P. wrote:

jezus … I feel stupid :slight_smile: Works great… Thanks a lot!

Glad to help.

Cheers,
Mohit.
9/26/2007 | 10:38 PM.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs