-
MonthName Function
I am trying to get MonthName to give me the previous month by doing this: MonthName((DatePart"m", Date(), 1)-1) but I am getting an illegal procedure call or argument error message. Can anyone help me with the syntax or can I even do this? Thanks.
casox
-
Code:
m = Month(Date() - 30)
Response.write(MonthName(m))
-
A further explanation: The reason it returns an error.... January's month is 1.. so when you 1-1, you end up with 0... Since no month is 0, the error happens.
You could try memnoch's approach, but that could lead to some problems as not all months are 30 days.... or add a simple check that will set the month to 12 when it is 0.
TG