使用SimpleDateFormat 将毫秒转换成时分秒 格式:HH:mm:ss

 

public static String dateFormatFromMilliSecond(long seconds) {   

 

    //初始化format格式

   SimpleDateFormat dateFormat= new SimpleDateFormat("HH:mm:ss");      

 

  //设置时区,跳过此步骤会默认设置为"GMT+08:00" 得到的结果会多出来8个小时

   dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));

 

   String time= dateFormat.format(seconds);

 

 return time;

}

posted @ 2018-11-19 21:48  Jiaweit  阅读(5431)  评论(0编辑  收藏  举报