package com.mzl.flower.utils;
|
|
import java.time.ZoneId;
|
import java.time.ZonedDateTime;
|
import java.time.format.DateTimeFormatter;
|
|
public class CronExpressionUtil {
|
/**
|
* convert Date to cron ,eg. "0 06 10 15 1 ? 2014"
|
* @param date : 时间点
|
* @return
|
*/
|
public static String getCron(ZonedDateTime date){
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("ss mm HH dd MM ? yyyy").withZone(ZoneId.of("Asia/Shanghai"));
|
return dateTimeFormatter.format(date);
|
}
|
}
|