您的位置:首页 > 其它

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

2018-11-19 21:48 239 查看

 

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;

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐