• 0

First ASP Script


Question

I've created an asp script to write whether the day is either an A day or a B day.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<%
dim setday
dim day
setday=date()

If setday="1/28/2010" Then
day="A Day"

ElseIf setday="1/29/2010" Then
day="B Day"

ElseIf setday="2/1/2010" Then
day="A Day"

ElseIf setday="2/2/2010" Then
day="B Day"

Else
day="weekend"

End If

Dim wordd
If day="A Day" or day="B Day" Then
wordd="Today is an"
Else
wordd="It is the"
End If
%>
<% response.write(wordd) %> <strong><% response.write(day) %></strong>.

Is there an easier way to list the days as an A or B day? Weekends + School Holidays would have to be skipped.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

It alternates everyday, so it would go like this for the next 2 weeks:

M- A

T- B

W- A

T- B

F- A

M- B

T- A

W- B

T- A

F- B

And it also skips over holidays as it would with the weekends.

Link to comment
Share on other sites

  • 0

 Dim sDay = DatePart(DateInterval.Weekday, Date.Now) '<-- obtains the day number (1 thru 7)
        Dim sWeek = DatePart(DateInterval.WeekOfYear, Date.Now) '<-- obtains the week number (1 thru 52)
        Dim Message As Text = ""

        If sWeek Mod 2 = 0 Then '<-- current week is even number
            If sDay Mod 2 = 0 Then '<--  day is even (2=Monday, 4 = Wednesday, 6 = Friday)
                Message = "A Day"
            Else '<-- day is odd (Tuesday, Thursday)
                Message = "B Day"
            End If
        Else '<-- week is an odd number
            If sDay Mod 2 = 0 Then '<--  day is even (2=Monday, 4 = Wednesday, 6 = Friday)
                Message = "B Day"
            Else '<-- day is odd (Tuesday, Thursday)
                Message = "A Day"
            End If
        End If

This doesn't take into account for holidays.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.