package com.heyu.api.data.utils;


import java.text.SimpleDateFormat;
import java.util.Date;

public class SqlDateParse {


    public static String addDays(String formate, Integer days) {
        Date date = DateUtils.addDays(new Date(), days);
        SimpleDateFormat sdf = new SimpleDateFormat(formate);
        return sdf.format(date);
    }


    public static Long addDaysReturnTimestamp(Integer days) {
        Date date = DateUtils.addDays(new Date(), days);
        return date.getTime();
    }


    public static Long addDaysReturnTimestamp(String formate, Integer days) {
        try {
            Date date = DateUtils.addDays(new Date(), days);
            SimpleDateFormat sdf = new SimpleDateFormat(formate);
            String dateStr = sdf.format(date);
            Date date1 = DateUtils.parseDate(dateStr);
            return date1.getTime();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return System.currentTimeMillis();
    }
}
