使用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;

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM