在ASP中检索日期

时间:2010-03-16 06:12:53

标签: asp-classic

我想从日期(文本框)中检索飞蛾,然后

如果检索的月份是1月,则必须添加一些功能。

CurrDate =session("txtdateFrom")
CurrMonthID=session("txtdateTo")
CurrMonthName=MonthName("CurrMonthID")


iF CurrMonthName=January                      /* This portion have error */

/*   some functions  */

else if CurrMonthName= February

/*  some functions */

1 个答案:

答案 0 :(得分:1)

MonthName函数以字符串格式返回月份名称。因此,

If lcase(CurrMonthName) = "january" Then
....
else if lcase(CurrMonthName) = "february" Then

但是,我建议使用Month函数返回月份的数字 所以,代码看起来像

dim monthNum = Month(myDate)

if monthNum = 1 Then
....
else if monthNum = 2 Then
相关问题