package com.koobietech.eas.common.utils;

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

/**
 * @author lc
 */
public class DateManager {
    public static String convertToYearMonthDay(Date date) {
        SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
        return outputFormat.format(date);
    }

    public static Date convertToYearMonthDayToDate(Date date) {
        SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return outputFormat.parse(outputFormat.format(date));
        } catch (ParseException e) {}
        return null;
    }
}
