How to schedule to run on last day of month?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
matthiasR
Pro Scripter
Posts: 52
Joined: Tue Jan 20, 2004 3:45 pm
Location: Lübbecke, Germany

How to schedule to run on last day of month?

Post by matthiasR » Tue Nov 22, 2016 2:32 pm

Hi,
i need to run a script on the last day of a month. Is this possible?
Or do i have to run the script every day, check what day it is and if its not the last day of the month then quit and If its the last day process the whole script?

Or is there a better way?

Regards,
Matthias

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: How to schedule to run on last day of month?

Post by Marcus Tettmar » Mon Nov 28, 2016 4:50 pm

I would use the following code and simply schedule it for every day:

Code: Select all

GetDate>today
DateAdd>today,d,1,tomorrow
DatePart>tomorrow,D,tomorrowDay
If>tomorrowDay=1
  ..
  .. your code here
  ..
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

matthiasR
Pro Scripter
Posts: 52
Joined: Tue Jan 20, 2004 3:45 pm
Location: Lübbecke, Germany

Re: How to schedule to run on last day of month?

Post by matthiasR » Mon Nov 28, 2016 6:52 pm

Marcus, thanks for sharing that code.

Regards,
Matthias

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: How to schedule to run on last day of month?

Post by CyberCitizen » Wed Nov 30, 2016 1:07 am

Such a simple solution, a fantastic program.
FIREFIGHTER

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: How to schedule to run on last day of month?

Post by Grovkillen » Wed Nov 30, 2016 7:01 am

Wow, simple and effective. Love it!
Let>ME=%Script%

Running: 15.0.27
version history

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