首页 > 数据库技术 > 详细

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

时间:2015-11-18 12:07:35      阅读:476      评论:0      收藏:0      [点我收藏+]

一、

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);

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

原文:http://www.cnblogs.com/janeaiai/p/4973943.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!