Asp classic 现在是星期一吗?

Asp classic 现在是星期一吗?,asp-classic,vbscript,Asp Classic,Vbscript,我有一个名为strRDate的日期字符串和另一个名为strColor的字符串。 截止日期是本周星期一 我想成为这样的人: '// strRDate format is MM/DD/YYYY Dim strRDate,strColor strRDate="1/1/1999" strColor="none" If strRDate is this weeks Monday or older then <-- HOW DO I DO THIS ??? strColor="g

我有一个名为
strRDate
的日期字符串和另一个名为
strColor
的字符串。 截止日期是本周星期一

我想成为这样的人:

'// strRDate format is MM/DD/YYYY

Dim strRDate,strColor
strRDate="1/1/1999"
strColor="none"   

 If strRDate is this weeks Monday or older then  <-- HOW DO I DO THIS ???
    strColor="green"
    else 
    strColor="red"
    end if
strRDate = "1/1/1999"
strColor = "none"

monday = Date - (Weekday(Date, vbMonday) - 1)

If CDate(strRDate) <= monday Then
  strColor="green"
Else 
  strColor="red"
End If
”//strRDate格式为MM/DD/YYYY
暗淡的颜色
strRDate=“1/1/1999”
strColor=“无”
如果strRDate为本周星期一或更早,则
和一些辅助函数:

Function GetColor(d) 
    GetColor = "none"

    If IsDate(d) Then
        If d <= GetMondayForWeek(Now()) Then
            GetColor = "green"
        Else
            GetColor = "red"
        End If
    End If
End Function

Function ParseDate(strDate)
    ParseDate = vbEmpty
    If IsDate(strDate) Then
        ParseDate = CDate(strDate)
    End If
End Function

Function GetMondayForWeek(d)
    ' midnight
    GetMondayForWeek = CDate(Fix(d))

    While Weekday(GetMondayForWeek) <> vbMonday
      GetMondayForWeek = GetMondayForWeek - 1 
    Wend
End Function
函数GetColor(d) GetColor=“无” 如果是日期(d),则 如果d 和一些辅助函数:

Function GetColor(d) 
    GetColor = "none"

    If IsDate(d) Then
        If d <= GetMondayForWeek(Now()) Then
            GetColor = "green"
        Else
            GetColor = "red"
        End If
    End If
End Function

Function ParseDate(strDate)
    ParseDate = vbEmpty
    If IsDate(strDate) Then
        ParseDate = CDate(strDate)
    End If
End Function

Function GetMondayForWeek(d)
    ' midnight
    GetMondayForWeek = CDate(Fix(d))

    While Weekday(GetMondayForWeek) <> vbMonday
      GetMondayForWeek = GetMondayForWeek - 1 
    Wend
End Function
函数GetColor(d) GetColor=“无” 如果是日期(d),则 如果d 和一些辅助函数:

Function GetColor(d) 
    GetColor = "none"

    If IsDate(d) Then
        If d <= GetMondayForWeek(Now()) Then
            GetColor = "green"
        Else
            GetColor = "red"
        End If
    End If
End Function

Function ParseDate(strDate)
    ParseDate = vbEmpty
    If IsDate(strDate) Then
        ParseDate = CDate(strDate)
    End If
End Function

Function GetMondayForWeek(d)
    ' midnight
    GetMondayForWeek = CDate(Fix(d))

    While Weekday(GetMondayForWeek) <> vbMonday
      GetMondayForWeek = GetMondayForWeek - 1 
    Wend
End Function
函数GetColor(d) GetColor=“无” 如果是日期(d),则 如果d 和一些辅助函数:

Function GetColor(d) 
    GetColor = "none"

    If IsDate(d) Then
        If d <= GetMondayForWeek(Now()) Then
            GetColor = "green"
        Else
            GetColor = "red"
        End If
    End If
End Function

Function ParseDate(strDate)
    ParseDate = vbEmpty
    If IsDate(strDate) Then
        ParseDate = CDate(strDate)
    End If
End Function

Function GetMondayForWeek(d)
    ' midnight
    GetMondayForWeek = CDate(Fix(d))

    While Weekday(GetMondayForWeek) <> vbMonday
      GetMondayForWeek = GetMondayForWeek - 1 
    Wend
End Function
函数GetColor(d) GetColor=“无” 如果是日期(d),则
如果d此日期的星期一可以通过减去工作日()并调整为星期一的工作日来计算:

  WScript.Echo "german locate (dd.mm.yyyy):"
  Dim dtCur : dtCur = #10/10/2013#
  Do Until dtCur > #10/24/2013#
     Dim dtThisMonday      : dtThisMonday      = DateAdd("d", -WeekDay(dtCur) + 2, dtCur)
     Dim isAfterThisMonday : isAfterThisMonday = dtCur > dtThisMonday
     WScript.Echo dtCur, WeekDay(dtCur), WeekdayName(WeekDay(dtCur), True), dtThisMonday, CStr(isAfterThisMonday)
     dtCur = DateAdd("d", 1, dtCur)
  Loop
输出:

german locate (dd.mm.yyyy):
10.10.2013 5 Thu 07.10.2013 True
11.10.2013 6 Fri 07.10.2013 True
12.10.2013 7 Sat 07.10.2013 True
13.10.2013 1 Sun 14.10.2013 False
14.10.2013 2 Mon 14.10.2013 False
15.10.2013 3 Tue 14.10.2013 True
16.10.2013 4 Wed 14.10.2013 True
17.10.2013 5 Thu 14.10.2013 True
18.10.2013 6 Fri 14.10.2013 True
19.10.2013 7 Sat 14.10.2013 True
20.10.2013 1 Sun 21.10.2013 False
21.10.2013 2 Mon 21.10.2013 False
22.10.2013 3 Tue 21.10.2013 True
23.10.2013 4 Wed 21.10.2013 True
24.10.2013 5 Thu 21.10.2013 True

此日期的星期一可以通过减去Weekday()并调整为周一的Weekday来计算:

  WScript.Echo "german locate (dd.mm.yyyy):"
  Dim dtCur : dtCur = #10/10/2013#
  Do Until dtCur > #10/24/2013#
     Dim dtThisMonday      : dtThisMonday      = DateAdd("d", -WeekDay(dtCur) + 2, dtCur)
     Dim isAfterThisMonday : isAfterThisMonday = dtCur > dtThisMonday
     WScript.Echo dtCur, WeekDay(dtCur), WeekdayName(WeekDay(dtCur), True), dtThisMonday, CStr(isAfterThisMonday)
     dtCur = DateAdd("d", 1, dtCur)
  Loop
输出:

german locate (dd.mm.yyyy):
10.10.2013 5 Thu 07.10.2013 True
11.10.2013 6 Fri 07.10.2013 True
12.10.2013 7 Sat 07.10.2013 True
13.10.2013 1 Sun 14.10.2013 False
14.10.2013 2 Mon 14.10.2013 False
15.10.2013 3 Tue 14.10.2013 True
16.10.2013 4 Wed 14.10.2013 True
17.10.2013 5 Thu 14.10.2013 True
18.10.2013 6 Fri 14.10.2013 True
19.10.2013 7 Sat 14.10.2013 True
20.10.2013 1 Sun 21.10.2013 False
21.10.2013 2 Mon 21.10.2013 False
22.10.2013 3 Tue 21.10.2013 True
23.10.2013 4 Wed 21.10.2013 True
24.10.2013 5 Thu 21.10.2013 True

此日期的星期一可以通过减去Weekday()并调整为周一的Weekday来计算:

  WScript.Echo "german locate (dd.mm.yyyy):"
  Dim dtCur : dtCur = #10/10/2013#
  Do Until dtCur > #10/24/2013#
     Dim dtThisMonday      : dtThisMonday      = DateAdd("d", -WeekDay(dtCur) + 2, dtCur)
     Dim isAfterThisMonday : isAfterThisMonday = dtCur > dtThisMonday
     WScript.Echo dtCur, WeekDay(dtCur), WeekdayName(WeekDay(dtCur), True), dtThisMonday, CStr(isAfterThisMonday)
     dtCur = DateAdd("d", 1, dtCur)
  Loop
输出:

german locate (dd.mm.yyyy):
10.10.2013 5 Thu 07.10.2013 True
11.10.2013 6 Fri 07.10.2013 True
12.10.2013 7 Sat 07.10.2013 True
13.10.2013 1 Sun 14.10.2013 False
14.10.2013 2 Mon 14.10.2013 False
15.10.2013 3 Tue 14.10.2013 True
16.10.2013 4 Wed 14.10.2013 True
17.10.2013 5 Thu 14.10.2013 True
18.10.2013 6 Fri 14.10.2013 True
19.10.2013 7 Sat 14.10.2013 True
20.10.2013 1 Sun 21.10.2013 False
21.10.2013 2 Mon 21.10.2013 False
22.10.2013 3 Tue 21.10.2013 True
23.10.2013 4 Wed 21.10.2013 True
24.10.2013 5 Thu 21.10.2013 True

此日期的星期一可以通过减去Weekday()并调整为周一的Weekday来计算:

  WScript.Echo "german locate (dd.mm.yyyy):"
  Dim dtCur : dtCur = #10/10/2013#
  Do Until dtCur > #10/24/2013#
     Dim dtThisMonday      : dtThisMonday      = DateAdd("d", -WeekDay(dtCur) + 2, dtCur)
     Dim isAfterThisMonday : isAfterThisMonday = dtCur > dtThisMonday
     WScript.Echo dtCur, WeekDay(dtCur), WeekdayName(WeekDay(dtCur), True), dtThisMonday, CStr(isAfterThisMonday)
     dtCur = DateAdd("d", 1, dtCur)
  Loop
输出:

german locate (dd.mm.yyyy):
10.10.2013 5 Thu 07.10.2013 True
11.10.2013 6 Fri 07.10.2013 True
12.10.2013 7 Sat 07.10.2013 True
13.10.2013 1 Sun 14.10.2013 False
14.10.2013 2 Mon 14.10.2013 False
15.10.2013 3 Tue 14.10.2013 True
16.10.2013 4 Wed 14.10.2013 True
17.10.2013 5 Thu 14.10.2013 True
18.10.2013 6 Fri 14.10.2013 True
19.10.2013 7 Sat 14.10.2013 True
20.10.2013 1 Sun 21.10.2013 False
21.10.2013 2 Mon 21.10.2013 False
22.10.2013 3 Tue 21.10.2013 True
23.10.2013 4 Wed 21.10.2013 True
24.10.2013 5 Thu 21.10.2013 True

我可能会这样计算:

'// strRDate format is MM/DD/YYYY

Dim strRDate,strColor
strRDate="1/1/1999"
strColor="none"   

 If strRDate is this weeks Monday or older then  <-- HOW DO I DO THIS ???
    strColor="green"
    else 
    strColor="red"
    end if
strRDate = "1/1/1999"
strColor = "none"

monday = Date - (Weekday(Date, vbMonday) - 1)

If CDate(strRDate) <= monday Then
  strColor="green"
Else 
  strColor="red"
End If

从函数的返回值中减去1,得到当前日期与最近一个星期一之间的天数差。从当前日期中减去该差值将得到最近一个星期一的日期,然后可以将其与输入日期进行比较(使用函数将字符串转换为实际日期)。

我可能会这样计算:

'// strRDate format is MM/DD/YYYY

Dim strRDate,strColor
strRDate="1/1/1999"
strColor="none"   

 If strRDate is this weeks Monday or older then  <-- HOW DO I DO THIS ???
    strColor="green"
    else 
    strColor="red"
    end if
strRDate = "1/1/1999"
strColor = "none"

monday = Date - (Weekday(Date, vbMonday) - 1)

If CDate(strRDate) <= monday Then
  strColor="green"
Else 
  strColor="red"
End If

从函数的返回值中减去1,得到当前日期与最近一个星期一之间的天数差。从当前日期中减去该差值将得到最近一个星期一的日期,然后可以将其与输入日期进行比较(使用函数将字符串转换为实际日期)。

我可能会这样计算:

'// strRDate format is MM/DD/YYYY

Dim strRDate,strColor
strRDate="1/1/1999"
strColor="none"   

 If strRDate is this weeks Monday or older then  <-- HOW DO I DO THIS ???
    strColor="green"
    else 
    strColor="red"
    end if
strRDate = "1/1/1999"
strColor = "none"

monday = Date - (Weekday(Date, vbMonday) - 1)

If CDate(strRDate) <= monday Then
  strColor="green"
Else 
  strColor="red"
End If

从函数的返回值中减去1,得到当前日期与最近一个星期一之间的天数差。从当前日期中减去该差值将得到最近一个星期一的日期,然后可以将其与输入日期进行比较(使用函数将字符串转换为实际日期)。

我可能会这样计算:

'// strRDate format is MM/DD/YYYY

Dim strRDate,strColor
strRDate="1/1/1999"
strColor="none"   

 If strRDate is this weeks Monday or older then  <-- HOW DO I DO THIS ???
    strColor="green"
    else 
    strColor="red"
    end if
strRDate = "1/1/1999"
strColor = "none"

monday = Date - (Weekday(Date, vbMonday) - 1)

If CDate(strRDate) <= monday Then
  strColor="green"
Else 
  strColor="red"
End If

从函数的返回值中减去1,得到当前日期与最近一个星期一之间的天数差。从当前日期中减去该差值将得到最近一个星期一的日期,然后可以将该日期与输入日期进行比较(使用函数将字符串转换为实际日期)。

我尝试过,但遇到了一个错误语法错误:函数GetColor(d)?我的函数中没有语法错误。我已经测试了我的代码。我试过了,但是我得到了一个错误语法错误:函数GetColor(d)?我的函数中没有语法错误。我已经测试了我的代码。我试过了,但是我得到了一个错误语法错误:函数GetColor(d)?我的函数中没有语法错误。我已经测试了我的代码。我试过了,但是我得到了一个错误语法错误:函数GetColor(d)?我的函数中没有语法错误。我已经测试了我的代码。我已经编辑了你的标题。请看“”,其中的共识是“不,他们不应该”。我已经编辑了你的标题。请看“”,其中的共识是“不,他们不应该”。我已经编辑了你的标题。请看“”,其中的共识是“不,他们不应该”。我已经编辑了你的标题。请参阅“”,其中的共识是“不,他们不应该”。