时间戳未正确插入数据库

时间:2015-10-18 09:27:21

标签: java sql oracle hibernate

我通过我的下面的java代码将日期值插入到名为Source的表的列中。

Date today = new Date();
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
String todayDate = df.format(today).toString();
myVO.setMyDate(todayDate);

myDao.saveOrUpdateVO(myVO);

稍后,我正在检索存储在Source表列中的日期值,并将该日期插入destination表。

现在,我注意到Source表中存储的日期值如下所示,

18-Oct-2015 00:00:0

destination表中存储的值为 - 18-Oct-2015 08:15:0

为什么会有这种差异?如果我想将日期值存储在Source表中,就像它存储在destination中一样,我需要做什么?

两个表中列的数据类型为date default sysdate

0 个答案:

没有答案