0

I am using agendajs to schedule the jobs. In docs, it is shown how to schedule jobs like

agenda.schedule('in 2 minutes', 'some jobs')

How can I schedule the job in specific date and time. I tried to use like below but didn't work

agenda.schedule('at 2018-7-24 09:47')

Any help is appreciated. Thanks

surazzarus
  • 772
  • 5
  • 17
  • 32

1 Answers1

1

As per the docs:

schedule(when, name, [data], [cb])

Schedules a job to run name once at a given time. when can be a Date or a String such as tomorrow at 5pm.

So something like:

agenda.schedule(new Date(), 'MyJob')

Should do it.

On the end of the day all this is doing is crating the job and setting the nextRunAt ISODate for that job record.

Akrion
  • 18,117
  • 1
  • 34
  • 54