Compare a date range to another date range

Results 1 to 2 of 2

Thread: Compare a date range to another date range

  1. #1
    Cable Guest

    Default Compare a date range to another date range

    Let&#039s say I have two date fields, Event_Date and End_Date. I am given two dates from the user. <BR><BR>Now I am to generate a calendar for the day and for the month, events can be more than one day. I need to generate the events for the day, and display a calendar for the month. <BR><BR>How can I find out if the date range from Event_Date to End_Date falls in the same range as the start date and end date given by the user?

  2. #2
    Cable Guest

    Default RE: Compare a date range to another date range

    Hello, is this one a stumper? I sent it to the SQL Guru and got no reply. <BR><BR>I might have found it with DateDiff, but I am not sure if it works properly.<BR><BR>In the WHERE clause:<BR><BR>(DateDiff(day,start_date,@StartPeri odDate) &#060;= 0<BR>Or DateDiff(day,end_date,@StartPeriodDate) &#060;= 0)<BR>AND<BR>(DateDiff(day,start_date,@EndPeriodDa te) &#062;= 0<BR>Or DateDiff(day,end_date,@EndPeriodDate) &#062;= 0)<BR><BR>Does this look correct?<BR><BR>Anyone, anyone, anyone? Bueller, Bueller, Bueller? :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •