static final SimpleDateFormat DATETIME_SEC_STR = new SimpleDateFormat("yyyyMMddHHmmss");
1.Date转Long
Long currStartTime = Long.valueOf(DATETIME_SEC_STR.format(new Date())); System.err.println("LONG1: " + currStartTime);
2.Long转Date
Date d1 = DATETIME_SEC_STR.parse(String.valueOf(20140811140810l)); System.err.println("DATE2: " + d1);
Long和Date数据类型之间相互转换代码
时间: 2024-11-09 04:36:13