Dim currentMonth As Integer
Dim yearMonthAgo As Integer ' if today is January then it will be previous year
Dim previousMonth As Integer
previousMonth = DatePart(DateInterval.Month, DateAdd(DateInterval.Month, -1, Today))
yearMonthAgo = DatePart(DateInterval.Year, DateAdd(DateInterval.Month, -1, Today))
currentMonth = DatePart(DateInterval.Month, DateAdd(DateInterval.Month, 0, Today))
Response.Write("First day of previous month is: " & DateAdd(DateInterval.Day, 0, DateValue(previousMonth.ToString & "/1/" & yearMonthAgo.ToString())))
Response.Write("<br />")
Response.Write("Last day of previous month is: " & DateAdd(DateInterval.Day, -1, DateValue(currentMonth.ToString & "/1/" & yearMonthAgo.ToString())))
More Info:
No comments:
Post a Comment