开发者

Retrieving Date in ASP

开发者 https://www.devze.com 2022-12-22 21:07 出处:网络
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.

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

精彩评论

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

关注公众号