package com.usoft.credit.util;

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

/**
 * @author liuam
 * @since 2018/8/13 0013 上午 11:54
 */
public class DateUtils {

    private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");

    private static  SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


    public static Date date(Date date) {

        try {
            date = sdfDate.parse(sdfDate.format(date));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }

    public static Date dateTime(Date date) {
        try {
            date = sdfDateTime.parse(sdfDateTime.format(date));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }

}
