text cron schedul表达

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text cron schedul表达相关的知识,希望对你有一定的参考价值。

cron(Minutes | Hours | Day-of-month | Month | Day-of-week | Year)

cron(0 0/4 * * ? *)         Every 4 hours
cron(0 10 * * ? *)          10:00AM UTC everyday
cron(15 12 * * ? *)         12:15PM UTC everyday
cron(0 18 ? * MON-FRI *)    6:00PM UTC every Mon-Fri
cron(0 8 1 * ? *)           8:00AM UTC every first day of the month
cron(0/10 * ? * MON-FRI *)  Every 10 min Mon-Fri
cron(0/5 8-17 ? * MON-FRI *)Every 5 minutes Mon-Fri between 8:00AM - 5:55PM UTC
cron(0 9 ? * 2#1 *)         9:00AM UTC first Monday of each month

Minutes			  0-59			      , - * /
Hours			    0-23			      , - * /
Day-of-month	1-31			      , - * ? / L W
Month			    1-12 or JAN-DEC	, - * /
Day-of-week		1-7 or SUN-SAT	, - * ? / L #
Year			    1970-2199		    , - * /

/	Specifies increments	0/15 in the minutes field directs execution to occur every 15 minutes.
L	Specifies "Last"	If used in Day-of-month field, specifies last day of the month. If used in Day-of-week field, specifies last day of the week (Saturday).
W	Specifies Weekday	When used with a date, such as 5/W, specifies the closest weekday to 5th day of the month. If the 5th falls on a Saturday, execution occurs on Friday. If the 5th falls on a Sunday, execution occurs on Monday.
#	Specifies the nd or nth day of the month	Specifying 3#2 means the second Tuesday of the month (Tuesday is the third day of the 7-day week).
*	Specifies All values	If used in the Day-of-month field, it means all days in the month.
?	No specified value	Used in conjunction with another specified value. For example, if a specific date is specified, but you don't care what day of the week it falls on.
-	Specifies ranges	10-12 would mean 10, 11 and 12
,	Specifies additional values	SUN,MON,TUE means Sunday, Monday and Tuesday
/	Specifies increments	5/10 means 5, 15, 25, 35, etc. 

以上是关于text cron schedul表达的主要内容,如果未能解决你的问题,请参考以下文章

@Scheduled cron表达式

@Scheduled(cron = "* * * * * *") cron表达式详解

@Scheduled(cron = "* * * * * *") cron表达式详解

@Scheduled注解cron的规则表达式

@Schedule注解中的Cron表达式读取properties的方法

Spring定时任务@Scheduled的cron表达式