标签:data format creat static 使用 mat actor .text type
package com.asiainfo.openapi.component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.asiainfo.openapi.service.ISyncMetaInfoService;
@EnableScheduling
@Component
@Lazy(false)
public class ScheduledQuartz {
@Autowired
private ISyncMetaInfoService syncService;
// @Scheduled(cron= "0 0/1 15,* * * ?")
// public void test() {
// System.out.println("测试每分钟执行一次:" + new Date());
// }
//0 0 1 ? * L 每周星期天凌晨1点实行一次;0 44 22 ? * SAT 每个周六的22:44执行
//0 0/2 * * * ? 每隔2分钟
// "0 15 10 ? * MON-FRI" 周一至周五的上午10:15触发
@Scheduled(cron= "0 44 22 ? * SAT")
// @Scheduled(cron= "0 */5 * * * ?")
public void run() throws ParseException {
long createTimes = System.currentTimeMillis() - 7*24*60*60*1000;
long createTime = createTimes/1000;
syncService.syncIncMetaDataByTime(createTime);
System.out.println("时间戳" + createTime);
System.out.println("当前时间" + new Date());
System.out.println("执行时间" + new Date(createTimes));
}
/*public static void main(String[] args) throws ParseException {
ScheduledQuartz scheduledQuartz = new ScheduledQuartz();
scheduledQuartz.run();
}*/
}
时间戳的实际使用
标签:data format creat static 使用 mat actor .text type
原文地址:https://www.cnblogs.com/sukuokuo/p/9648027.html