node cron schedule specific time

Solutions on MaxInterview for node cron schedule specific time by the best coders in the world

showing results for - "node cron schedule specific time"
Beatrice
29 Jul 2020
1const CronJob = require('../lib/cron.js').CronJob;
2
3console.log('Before job instantiation');
4let date = new Date();
5date.setSeconds(date.getSeconds()+2);
6const job = new CronJob(date, function() {
7	const d = new Date();
8	console.log('Specific date:', date, ', onTick at:', d);
9});
10console.log('After job instantiation');
11job.start();