开发者

Retrieving Date in ASP

I want to retrieve the moth from a date(i开发者_运维知识库n textbox),then

If that retrieved month is January ,some functions have to be added.

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


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

/*   some functions  */

else if CurrMonthName= February

/*  some functions */


MonthName function returns the name of the month in string format. Hence,

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

However, I suggest using Month function that will return you the number for the month.
So, the code will look like

dim monthNum = Month(myDate)

if monthNum = 1 Then
....
else if monthNum = 2 Then
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜