简单写个方法方便自己以后取值
字符串转日期、毫秒;毫秒转日期、字符串;

public static void main(String[] args) {
    String dateStr = "2019-06-05 12:00:00";
    Long time = 1559793600000L;
    System.out.println("字符串转日期:" + dateStr + " --- " + stringToDate(dateStr));
    System.out.println("字符串转毫秒:" + dateStr + " --- " + stringToTime(dateStr));
    System.out.println("毫秒转日期  :" + time + " --- " + timeToDate(time));
    System.out.println("毫秒转字符串:" + time + " --- " + timeToString(time));
}
public static Date stringToDate(String dateStr){
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = null;
    try {
        date = format.parse(dateStr);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date;
}
public static Long stringToTime(String dateStr){
    Date date = stringToDate(dateStr);
    return date.getTime();
}
public static Date timeToDate(Long time){
    Date date = new Date();
    date.setTime(time);
    return date;
}
public static String timeToString(Long time){
    Date date = timeToDate(time);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    return simpleDateFormat.format(date);
}

执行结果:

字符串转日期:2019-06-05 12:00:00 --- Wed Jun 05 12:00:00 CST 2019
字符串转毫秒:2019-06-05 12:00:00 --- 1559707200000
毫秒转日期  :1559793600000 --- Thu Jun 06 12:00:00 CST 2019
毫秒转字符串:1559793600000 --- 2019-06-06 12:00:00

文章仅作为个人学习整理