// 日期转毫秒
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
long millionSeconds = sdf.parse("20120809030000").getTime();//毫秒
System.out.println(millionSeconds);
// 毫秒转日期
Calendar c = Calendar.getInstance();
c.setTimeInMillis(millionSeconds);
Date date = c.getTime();
System.out.println(sdf.format(date));
http://www.cnblogs.com/alipayhutu/archive/2012/08/08/2627983.html
时间: 2024-10-02 11:27:13