/**
* 时间unix转换
* @param timestampString
* @return
*/
public static String TimeStampDate(String timestampString, String format) {
Long timestamp = Long.parseLong(timestampString) * 1000;
String date = new java.text.SimpleDateFormat(format).format(new java.util.Date(timestamp));
return date;
}
/**
* 将时间unix转换为int类型
* @param timeString
* @param format
* @return
*/
public static int DateToInt(String timeString, String format) {
int time = 0;
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date date = sdf.parse(timeString);
String strTime = date.getTime() + "";
strTime = strTime.substring(0, 10);
time = Integer.parseInt(strTime);
}
catch (ParseException e) {
e.printStackTrace();
}
return time;
}