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);

 

相关文章:

  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-08-28
  • 2021-05-25
猜你喜欢
  • 2021-05-18
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案