老是遇到时间转换,时间久了有点忘记,在此记录一下
public static String format(Long time){//time 是毫秒数
Calendar c = Calendar.getInstance();
c.setTimeInMillis(time);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(c.getTime());
}
老是遇到时间转换,时间久了有点忘记,在此记录一下
public static String format(Long time){//time 是毫秒数
Calendar c = Calendar.getInstance();
c.setTimeInMillis(time);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(c.getTime());
}
转载于:https://my.oschina.net/u/2430902/blog/490975