例如我想在2019/01/09的22:00执行我的代码,我该怎么做? 这是我的代码,但是不起作用:
val trigger = TriggerBuilder.newTrigger
.withIdentity("Trigger", "Group")
.startAt( new Date(2019,1,9, 16,45))
.build()
答案 0 :(得分:0)
下面的代码应该可以在2019/01/09的22:00执行代码:
val cronExpression = "0 0 22 9 JAN ? 2019" //At 22:00:00pm, on the 9th day, in January, in 2019
val trigger: CronTrigger = TriggerBuilder.newTrigger()
.withIdentity(triggerName, jobGroup)
.withSchedule(CronScheduleBuilder.cronSchedule(cronExpression))
.forJob(jobName, jobGroup)
.build