//1
String dateStr = "Jun 26,2014 4:15:04 PM";
DateFormat formatFrom = new SimpleDateFormat("MMM dd,yyyy KK:mm:ss aa", Locale.ENGLISH);
Date date = formatFrom.parse(dateStr);
DateFormat formatTo = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(formatTo.format(date));
//2
Date date = new Date();
// set the time for 12345678 milliseconds after
// january 1, 1970 00:00:00 gmt. 距离1970年的毫秒数
Long as = Long.parseLong("12345678");
try {
date.setTime(as);
}catch (Exception e) {
}