Date Calculation...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tom feldman

    #1

    Date Calculation...

    I am hoping somebody can help me solve this problem...

    I need to write .asp code for a web page that adds 3-7 'business' days
    to a given date. I can retrieve the date just fine, but, how do I add
    3-7 business days to it (excluding the weekends). I'm not worried about
    holidays, just weekends.

    Any help would be greatly appreciated!

    -T

    *** Sent via Developersdex http://www.developersdex.com ***
  • McKirahan

    #2
    Re: Date Calculation...

    "tom feldman" <tomfeldman@gma il.com> wrote in message
    news:kQmne.37$4 A3.4728@news.us west.net...[color=blue]
    > I am hoping somebody can help me solve this problem...
    >
    > I need to write .asp code for a web page that adds 3-7 'business' days
    > to a given date. I can retrieve the date just fine, but, how do I add
    > 3-7 business days to it (excluding the weekends). I'm not worried about
    > holidays, just weekends.
    >
    > Any help would be greatly appreciated!
    >
    > -T
    >
    > *** Sent via Developersdex http://www.developersdex.com ***[/color]

    Why "3-7" days?


    Play with this -- it adds 3 "business" days to a date:

    Option Explicit

    Const cVBS = "AddDays.vb s"
    Const cDAZ = 3

    Dim strDAT
    strDAT = InputBox("Enter a date.",cVBS,Dat e)
    If IsDate(strDAT) Then
    Dim strNEW
    strNEW = DateAdd("d",cDA Z,strDAT)
    If DatePart("w",st rNEW,vbMonday) >= 6 Then
    strNEW = DateAdd("d",2,s trNEW)
    End If
    WScript.Echo strDAT & " + " & cDAZ & " business days = " & strNEW
    End If


    Comment

    • McKirahan

      #3
      Re: Date Calculation...

      "McKirahan" <News@McKirahan .com> wrote in message
      news:6KadnQusTO usYADfRVn-vg@comcast.com. ..[color=blue]
      > "tom feldman" <tomfeldman@gma il.com> wrote in message
      > news:kQmne.37$4 A3.4728@news.us west.net...[color=green]
      > > I am hoping somebody can help me solve this problem...
      > >
      > > I need to write .asp code for a web page that adds 3-7 'business' days
      > > to a given date. I can retrieve the date just fine, but, how do I add
      > > 3-7 business days to it (excluding the weekends). I'm not worried about
      > > holidays, just weekends.
      > >
      > > Any help would be greatly appreciated!
      > >
      > > -T
      > >
      > > *** Sent via Developersdex http://www.developersdex.com ***[/color]
      >
      > Why "3-7" days?
      >
      >
      > Play with this -- it adds 3 "business" days to a date:
      >
      > Option Explicit
      >
      > Const cVBS = "AddDays.vb s"
      > Const cDAZ = 3
      >
      > Dim strDAT
      > strDAT = InputBox("Enter a date.",cVBS,Dat e)
      > If IsDate(strDAT) Then
      > Dim strNEW
      > strNEW = DateAdd("d",cDA Z,strDAT)
      > If DatePart("w",st rNEW,vbMonday) >= 6 Then
      > strNEW = DateAdd("d",2,s trNEW)
      > End If
      > WScript.Echo strDAT & " + " & cDAZ & " business days = " & strNEW
      > End If
      >[/color]

      I offered a VBScript solution as it better supports date math.

      ASP readily supports VBScript.


      Comment

      • tom feldman

        #4
        Re: Date Calculation...

        First of all, thank you for taking the time to help me.

        I took that script and put it into an .asp page by itself and posted it
        to the live server, but it says that the page cannot be displayed? I
        cannot run it on my IIS on XP Pro right now because of some conflict I'm
        having with SP2 that I installed yesterday. If I could run it, it might
        show me where it's having problems...

        Now, as I am kind of new to this, could the .vbs script be causing the
        problem on the server??

        -T



        *** Sent via Developersdex http://www.developersdex.com ***

        Comment

        • McKirahan

          #5
          Re: Date Calculation...

          "tom feldman" <tomfeldman@gma il.com> wrote in message
          news:blnne.42$4 A3.4876@news.us west.net...[color=blue]
          > First of all, thank you for taking the time to help me.
          >
          > I took that script and put it into an .asp page by itself and posted it
          > to the live server, but it says that the page cannot be displayed? I
          > cannot run it on my IIS on XP Pro right now because of some conflict I'm
          > having with SP2 that I installed yesterday. If I could run it, it might
          > show me where it's having problems...
          >
          > Now, as I am kind of new to this, could the .vbs script be causing the
          > problem on the server??
          >
          > -T[/color]

          Does your ASP page have JScript and VBScript?

          If not, try putting this as the first line in the page:

          <% @Language="VBSc ript" %>


          Comment

          Working...