来源维基百科:
Question mark (?) is used instead of '*' for leaving either day-of-month or day-of-week blank.
上述说法对我来说没有多大意义。
所以如果我写一些 cron 作为 0 0 0 ? * *
那么它是指每个月的第一天还是意味着它将每天执行?
这有点令人困惑,因为 Java crons 以秒开头,而其他 crons 以分钟开头。
最佳答案
根据Quartz CronTrigger tutorial (Quartz 被 www.cronmaker.com 使用,如上所引用),?
通配符仅用于月日和星期几字段:
? ("no specific value") - useful when you need to specify something in one of the two fields in which the character is allowed, but not the other. For example, if I want my trigger to fire on a particular day of the month (say, the 10th), but don't care what day of the week that happens to be, I would put "10" in the day-of-month field, and "?" in the day-of-week field.
我猜 *
在这里不合适,因为 *
意味着在一周中的每一天执行,这与它应该只在 10 日运行的规则相矛盾月份。
关于java - Java cron中问号的意义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11499740/