Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Date Ranges [modified]

Date Ranges [modified]

Scheduled Pinned Locked Moved Database
questiondatabasehelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mobius111001
    wrote on last edited by
    #1

    I'm having a little bit of brain fry going on... How can I go about to see if any date within a date range is in another date range? Example: Is any date between 01/01/2008 - 12/31/2015 in 11/21/2008 - 12/21/2009? MOD: Ok, so I think I found my answer. Does anyone see an issue with this comparison? 01/01/2008 < 12/21/2009 AND 12/31/2015 > 11/21/2008 [obviously these would be parameters and fields in a database.... paramStart < dbEnd AND paramEnd > dbStart]

    modified on Monday, December 1, 2008 3:09 PM

    W 1 Reply Last reply
    0
    • M mobius111001

      I'm having a little bit of brain fry going on... How can I go about to see if any date within a date range is in another date range? Example: Is any date between 01/01/2008 - 12/31/2015 in 11/21/2008 - 12/21/2009? MOD: Ok, so I think I found my answer. Does anyone see an issue with this comparison? 01/01/2008 < 12/21/2009 AND 12/31/2015 > 11/21/2008 [obviously these would be parameters and fields in a database.... paramStart < dbEnd AND paramEnd > dbStart]

      modified on Monday, December 1, 2008 3:09 PM

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      mobius111001 wrote:

      Is any date between 01/01/2008 - 12/31/2015 in 11/21/2008 - 12/21/2009?

      If

      date1 = 01/01/2008
      date2 = 12/31/2015
      date3 = 11/21/2008
      date4 = 12/21/2009

      then it would be something like:

      ... date1 between date3 and date4
      or date2 between date3 and date4
      or (date1 < date3 and date2 > date4) ...

      The need to optimize rises from a bad design.My articles[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups