将毫秒时间转换为yyyy-MM-dd HH:mm:ss格式

  /**
     * 将毫秒时间转换为yyyy-MM-dd HH:mm:ss格式
     */
    public static String getDateFromTimeMillis(Long timeMillis) {
        Date date = new Date();
        date.setTime(timeMillis);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateStr = sdf.format(date);
        return dateStr;
    }

 

posted @ 2018-11-16 19:56  ^sun^  阅读(472)  评论(0编辑  收藏  举报