VbScript: Number of days in month

Code:

daysInMonth = Day(DateSerial(thisYear, thisMonth + 1, 0))

It adds 1 to the month and uses DateSerial to get a Date representing the 0th day of the following month. That is the last day of the month you entered. The Day function gives you the number of that day, which equals the number of days in the month.

7 thoughts on “VbScript: Number of days in month

Leave a reply to Sharath Pai (@sharathpai5) Cancel reply