将时间转换为时间戳
public static long dateToStamp(String s) throws ParseException{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = simpleDateFormat.parse(s);
return date.getTime();
}
将时间戳转换为时间
public static String stampToDate(long ltime){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(ltime);
return simpleDateFormat.format(date);
}