Scheduled script to run on Last day of every month at 00:00:00

Nani7
Tera Contributor

Hi All,

I need a small confirmation for the below requirement.

Actually, there is an event that should be triggered on last day of every month [as Number of days in a month is not same] at 00:00:00. For Eg. 28th Feb 2019 00:00:00 but not at 28th Feb 2019 23:59:59.

I have read in ServiceNow docs as follows:

find_real_file.png

So, I have set the scheduled time as follows:

find_real_file.png

Now I have a doubt whether this would run correctly on 28th Feb 2019 00:00:00 or any other month if the last day is not 31st.

 

Please confirm!

Regards,

Nani

1 ACCEPTED SOLUTION

Yes, setting the run date to the 31st at 00:00:00 will run the job on the last day of every month at 00:00:00 only.  Not at any other time during the day.

View solution in original post

11 REPLIES 11

Ian Mildon
Tera Guru

In my experience ServiceNow does trigger the scheduled task on the last day, regardless of the actual number of days in the month, following the tip you pasted.

Nani7
Tera Contributor

Hi Ian,

Thanks for the reply.

I just want to know if this runs on last day of every month at 00:00:00 only! It should not run at any time other than 00:00:00 on every last day of month!

 

Regards,

Nani

Tushar Sharma2
Kilo Guru

Yes It will run on 30th,28th and 29th(if leap year) if you select 31. Scheduling an event for the 29th or 30th is not recommended by serviceNow.
Check below document from serviceNow.

Special cases in job schedules

Mark Correct if it solved your issue.
Regards,
Tushar Sharma
www.dxsherpa.com

Hi Tushar,

Thanks for the reply.

I just want to know if this runs on last day of every month at 00:00:00 only! It should not run at any time other than 00:00:00 on every last day of month!

 

Regards,

Nani

Nick Simonelli1
Mega Expert

To put it right here, in case the link that Tushar responded with ever changes, here is the relevant portion: "

Because months have different lengths, take care when scheduling jobs for the end of the month.

  • Scheduling an event for the 29th or 30th is not recommended, because the scheduled job will not be executed in months (like February) which are shorter than those dates.
  • If an event is scheduled for the 31st, it will be executed on the last day of the month, even if the month is shorter.
For example, something scheduled to run on the 31st of the month will run on February 28th or February 29th in a leap year."