标签:
日期->字符串,字符串->日期;日期->毫秒,毫秒>日期-
private static void getDate() { // TODO Auto-generated method stub long time = System.currentTimeMillis(); Date date = new Date(time); System.out.println("毫秒转日期"+date); System.out.println("日期转毫秒"+date.getTime()); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:dd:SS"); String s = dateFormat.format(date); System.out.println("日期转字符串"+s); try { System.out.println("字符串转日期"+dateFormat.parse(s)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
毫秒转换为多少天时,可以毫秒/1000/60/60/24
标签:
原文地址:http://www.cnblogs.com/qiaoyeye/p/5198590.html