Determine num of day in each month of the year

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Determine num of day in each month of the year

Post by PepsiHog » Sat Jun 19, 2010 3:14 am

Hey Everyone,

I need a way to accurately calculate how many days in any month of any year. I'm sure there is a mathematical solution, but I don't have any idea what that would be.

Do you?

Or how could I retrieve the number of days for the current month from the web automatically? (contained in a variable)

Thanks!
PepsiHog

BTW - I'm using v11
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

find number of days in a month using VBScript

Post by adroege » Sat Jun 19, 2010 7:51 am

Try this:

Code: Select all

VBSTART
Function Days_in_Month(mymonth,myyear)
  Days_in_Month = Day(DateSerial(myyear, 1 + mymonth, 0))
End Function
VBEND

//Pass in the month number i.e. 1=January 2=February, etc
//Pass in the year i.e. 2009,2010,etc
VBEval>Days_in_Month(2,2009),result
MessageModal>Days in Month = %result%

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Sun Jun 20, 2010 12:08 am

ummmm........ How can I say this....

AWESOME!!! DUDE!!

Thanks! adroege!
Works perfectly!
PepsiHog

I'll drink a pepsi on your behalf. :lol:
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts