Android---- 如何把calendar.getTimeInMillis()获得的毫秒时间


 

如何把calendar.getTimeInMillis()获得的毫秒时间格式化为yyyy-MM-dd样式的时间

  622人阅读   评论(0)   收藏   举报

如何把calendar.getTimeInMillis()获得的毫秒时间,已经写入数据库了而且转化为了字符串型例如:1229073608937样式的时间格式化为yyyy-MM-dd样式的时间?

 

一、

long time = 1229073608937L; Date date = new Date(time); java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd"); String timestring = f.format(date);

 

二、

String str = String.format("%tF %<tT", 1229159619623L);


免责声明!

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



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