字符串时间与Unix时间戳相互转换
/** * @Author: wangkun * @Date : 2016/1/21 13:43 * @Description : 字符串时间转换为Unix时间戳 */public static String date2TimeStamp(String dateString) throws ParseException { Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateString); long unixTimestamp = date.getTime()/1000; return String.valueOf(unixTimestamp);}/** * @Author: wangkun * @Date : 2016/1/21 13:43 * @Description : Unix时间戳转换成字符串时间 */public static String timeStamp2Date(String timestampString){ Long timestamp = Long.parseLong(timestampString)*1000; String date = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date(timestamp)); return date;}