VbScript: Number of days in month


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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s