如何把calendar.getTimeInMillis()获得的毫秒时间,已经写入数据库了而且转化为了字符串型例如:1229073608937样式的时间格式化为yyyy-MM-dd样式的时间?

一、

long time = 1229073608937L;
Date date = new Date(time);
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd");
String timestring = f.format(date);

二、

String str = String.format("%tF %<tT", 1229159619623L);

原文地址:https://www.cnblogs.com/janeaiai/p/4973943.html