JAVA日期Date格式转corn表达式

 

date转corn 定时任务获取corn

 

 /***
     * 日期转corn表达式
     * @param date 日期
     * @return
     */
    public static String getCron(Date  date){
        String dateFormat="ss mm HH dd MM ? yyyy";
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        String corn = null;
        if (date != null) {
            corn = sdf.format(date);
        }
        return corn;
    }

 

posted @ 2021-07-10 00:59  yvioo  阅读(1555)  评论(0编辑  收藏  举报