河边的青荇
2017-09-27 05:47时间类型转换timestamp转成正常的时间格式
2017-08-27 10:00:00.0 如何转成2017-08-27 10:00:00
数据库里面是timestamp格式,查到的格式就是2017-08-27 10:00:00.0,现在显示的时候要求不要最后那个.0
String temp = rs.getString(columnName);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date1 = new Date(temp);
value = simpleDateFormat.format(date);
System.out.println("转换之后的时间"+value);
这个方法不适用
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- 将MySQL日期时间字符串转换为time.Time格式
- datetime
- time
- 2个回答
- 如何将日期时间转换为unix命令日期
- mysql
- xml
- sitemap
- php
- 3个回答
- 时间问题Date与Timestamp
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
- java 国际化时间问题
- 企业应用
- 0个回答
- 关于ibatis使用resultClass="HashMap"的时间转换问题
- ibatis
- 0个回答
换一换