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. Web Development
  3. ASP.NET
  4. Detecting Weekend dates between two given dates

Detecting Weekend dates between two given dates

Scheduled Pinned Locked Moved ASP.NET
helptutorial
4 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.
  • A Offline
    A Offline
    Ayorinde Banjo
    wrote on last edited by
    #1

    I want to write code to determine the number of weekend days (i.e. Saturday and Sunday) in between two given dates. For example locate saturday and sunday between [05/21/2009 and 07/06/2009]. Any help will be appreciated.

    Banjo Ayorinde

    M 1 Reply Last reply
    0
    • A Ayorinde Banjo

      I want to write code to determine the number of weekend days (i.e. Saturday and Sunday) in between two given dates. For example locate saturday and sunday between [05/21/2009 and 07/06/2009]. Any help will be appreciated.

      Banjo Ayorinde

      M Offline
      M Offline
      Muhammad Mazhar
      wrote on last edited by
      #2

      try using AddDay function of data object. First loop from start date to end date. For each iteration call add day with value 1 and then check returned date if its week end then increment your counter variable.

      Share your experience with others Check my Blog...

      A 1 Reply Last reply
      0
      • M Muhammad Mazhar

        try using AddDay function of data object. First loop from start date to end date. For each iteration call add day with value 1 and then check returned date if its week end then increment your counter variable.

        Share your experience with others Check my Blog...

        A Offline
        A Offline
        Ayorinde Banjo
        wrote on last edited by
        #3

        Thanks for your response. Please am a newbie in c# asp.net Can you please help me with sample code on how to iterate through two dates (e.g. 04/25/2008 to 05/21/2008) Thank you in anticipation

        Banjo Ayorinde

        M 1 Reply Last reply
        0
        • A Ayorinde Banjo

          Thanks for your response. Please am a newbie in c# asp.net Can you please help me with sample code on how to iterate through two dates (e.g. 04/25/2008 to 05/21/2008) Thank you in anticipation

          Banjo Ayorinde

          M Offline
          M Offline
          Muhammad Mazhar
          wrote on last edited by
          #4

          Code sample is not possiable because right now I am away from my desktop, here is a PHP example link. It will give you enough idea about solution http://bytes.com/topic/php/answers/447768-how-do-you-get-list-all-dates-between-two-dates-more-than-day-apart[^]

          Share your experience with others Check my Blog...

          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