java 给固定日期字符串加上当前的 时分秒

怎么不在转换之前就加上时分秒,接到字符串后 String s = "1988-04-16 ";Date date = new Date();DateFormat df = new SimpleDateFormat("hh:mm:ss");s = s + df(date);拼接后再转成java.sql.Date testDate不就OK了吗
java 给固定日期字符串加上当前的 时分秒
怎么不在转换之前就加上时分秒,接到字符串后

String s = "1988-04-16 ";
Date date = new Date();
DateFormat df = new SimpleDateFormat("hh:mm:ss");
s = s + df(date);
拼接后再转成java.sql.Date testDate不就OK了吗2013-09-25
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
java.util.Date currentTime = new java.util.Date();
String time = simpleDateFormat.format(currentTime).toString();

当前系统时间:time2013-09-25
sql.date是没有时分秒的
可以使用这个java.sql.Timestamp2013-09-25
mengvlog 阅读 6 次 更新于 2025-07-19 05:03:02 我来答关注问题0
檬味博客在线解答立即免费咨询

Java相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部