简体   繁体   中英

How to create a cron job to run every 30 days in nodejs

我正在尝试使用cron编写一个每 30 天运行一次的 cron 作业。

Using cron this is how i was able to solve it... Thanks to @Jonathan Brooks

var CronJob = require('cron').CronJob;
new CronJob({
  cronTime: '00 00 00 28,29,30 * *',
  onTick: function() {
    console.log('Runs every 28, 29(february) or 30 days');
  },
  start: true,
  timeZone: 'America/Los_Angeles'
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM