Skip to content
Advertisement

How to schedule node-cron job every new month?

I am using node-cron package for scheduling node-cron jobs. I want to schedule an node-cron job which will run every new month. for example: My node-cron job should run at 1 September 2020 after that it should run at 1 October 2020 and and so on..! Please help me out for the above issue. Thanks in advance.

Advertisement

Answer

Following this tutorial I believe you just have to do:

const cron = require("node-cron");

cron.schedule("* * 1 * *", function() {
  // Do something
});

where:

enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement