【发布时间】:2013-06-20 14:10:35
【问题描述】:
我正在使用 JPA 和 MySQl
在我的域对象中,我有一个日期字段
@Temporal(TemporalType.TIMESTAMP)
private Date lastSeenDate;
在我的 UI 中,日期以 dd-mm-yyyy 格式的字符串形式显示
我用过
final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
final Date date = format.parse(dateString);
但对于字符串日期
06-06-2013
mysql中存储的日期是
0011-12-04 00:00:00.0
如何将其存储到mysql中以匹配mysql格式
【问题讨论】:
-
使用
format.format(date); -
请说明你得到什么样的约会以及你想要得到什么
-
“带有时间戳”是什么意思?我怀疑您误解了 java.util.Date 的含义。
-
你的问题很模糊。最好显示所有相关代码,显示输入、实际输出和预期输出...
-
你的 dateString 到底是什么?
标签: java date simpledateformat