代码调通立刻给分!!

unique 2002-09-06 01:31:57
代码报错!程序员没在!!

disDate = date()
curDate = request("date")
if curDate = "" or not isDate(curDate) then
curDate = date()
end if

curDateShow = Ucase(MonthName(Month(curDate))) & " " & Year(curDate)

iDIM = GetDaysInMonth(Month(curDate), Year(curDate))
iDOW = GetWeekdayMonthStartsOn(curDate)

navDate = CDate(MonthName(month(curdate)) & " 1, " & year(curdate))'这行报错:类型不匹配
navDateLast = CDate(MonthName(Month(navDate)) & " " & iDIM & ", " & Year(navDate))
...全文
106 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
unique 2002-09-06
  • 打赏
  • 举报
回复
ksy(ASP.Net入门) ( ) 信誉:110
厉害!!一下搞定,谢了!立刻结账!
ksy 2002-09-06
  • 打赏
  • 举报
回复
<%
Function GetDaysInMonth(iMonth, iYear)
Dim dTemp
dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
GetDaysInMonth = Day(dTemp)
End Function

Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
Dim dTemp
dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function

Function SubtractOneMonth(dDate)
SubtractOneMonth = DateAdd("m", -1, dDate)
End Function

Function AddOneMonth(dDate)
AddOneMonth = DateAdd("m", 1, dDate)
End Function

Dim iDIM ' Days In Month
Dim iDOW ' Day Of Week that month starts on
Dim iCurrent ' Variable we use to hold current day of month as we write table
Dim iPosition ' Variable we use to hold current position in table

disDate = date()
curDate = request("date")
if curDate = "" or not isDate(curDate) then
curDate = date()
end if

curDateShow = Ucase(MonthName(Month(curDate))) & " " & Year(curDate)

'iDIM = GetDaysInMonth(Month(curDate), Year(curDate))
'iDOW = GetWeekdayMonthStartsOn(curDate)
iDIM = GetDaysInMonth(Month(cdate(curDate)), Year(cdate(curDate)))
iDOW = GetWeekdayMonthStartsOn(cdate(curDate))
'下两句做改动
navDate = CDate(month(curdate) & ",1," & year(curdate))
navDateLast = CDate(Month(navDate) & " " & iDIM & ", " & Year(navDate))
'
lastMonth = SubtractOneMonth(curDate)
nextMonth = AddOneMonth(curDate) %>
qiushuiwuhen 2002-09-06
  • 打赏
  • 举报
回复
先SetLocale一下,否则是中文的MonthName
SetLocale("en-gb")
curdate=date
navDate = CDate(MonthName(month(curdate)) & " 1, " & Year(curdate))


为什么不用
navDate = CDate( Year(curdate)& "-" & month(curdate) & "-1")
fokker 2002-09-06
  • 打赏
  • 举报
回复
Try
curDate = request("date")
改:
curDate = (Request.Form("date"))(1)
zqfleaf 2002-09-06
  • 打赏
  • 举报
回复

navDate = CDate(MonthName(month(curdate)) & " 1, " & year(curdate))'这行报错:类型不匹配
navDateLast = CDate(MonthName(Month(navDate)) & " " & iDIM & ", " & Year(navDate))
不用Cdate

navDate =MonthName(month(curdate)) & " 1, " & year(curdate)
navDateLast = MonthName(Month(navDate)) & " " & iDIM & ", " & Year(navDate)

unique 2002-09-06
  • 打赏
  • 举报
回复
完整代码如下:

<%
Function GetDaysInMonth(iMonth, iYear)
Dim dTemp
dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
GetDaysInMonth = Day(dTemp)
End Function

Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
Dim dTemp
dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function

Function SubtractOneMonth(dDate)
SubtractOneMonth = DateAdd("m", -1, dDate)
End Function

Function AddOneMonth(dDate)
AddOneMonth = DateAdd("m", 1, dDate)
End Function

Dim iDIM ' Days In Month
Dim iDOW ' Day Of Week that month starts on
Dim iCurrent ' Variable we use to hold current day of month as we write table
Dim iPosition ' Variable we use to hold current position in table

disDate = date()
curDate = request("date")
if curDate = "" or not isDate(curDate) then
curDate = date()
end if

curDateShow = Ucase(MonthName(Month(curDate))) & " " & Year(curDate)

'iDIM = GetDaysInMonth(Month(curDate), Year(curDate))
'iDOW = GetWeekdayMonthStartsOn(curDate)

iDIM = GetDaysInMonth(Month(cdate(curDate)), Year(cdate(curDate)))
iDOW = GetWeekdayMonthStartsOn(cdate(curDate))

navDate = CDate(MonthName(month(curdate)) & " 1, " & year(curdate))
navDateLast = CDate(MonthName(Month(navDate)) & " " & iDIM & ", " & Year(navDate))

lastMonth = SubtractOneMonth(curDate)
nextMonth = AddOneMonth(curDate) %>
unique 2002-09-06
  • 打赏
  • 举报
回复
这行还是报错:类型不匹配cdate
unique 2002-09-06
  • 打赏
  • 举报
回复
OK,我试试先
fokker 2002-09-06
  • 打赏
  • 举报
回复
iDIM = GetDaysInMonth(Month(curDate), Year(curDate))
iDOW = GetWeekdayMonthStartsOn(curDate)
改:
iDIM = GetDaysInMonth(Month(cdate(curDate)), Year(cdate(curDate)))
iDOW = GetWeekdayMonthStartsOn(cdate(curDate))

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧