package cn.neolo.app.ireach.Utils;

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

/**
 * Created by Neolo on 2017.8.20.
 */

public class DateUtil {
    /**
     * 将日期类型转换成毫秒数
     */
    static public long changeDate(String data) {
        Date parse = null;
        try {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            parse  = simpleDateFormat.parse(data);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return parse.getTime();
    }

    /**
     * 毫秒数获取相应的月份日期
     */

    static public String getMMdd(long date) {
        Date time = new Date(date);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd");
        return simpleDateFormat.format(time);
    }

    static public String getHHmmss(long date) {
        Date time = new Date(date);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
        return simpleDateFormat.format(time);
    }
}
