我在数据库 v.2.2.5 中存储日期时遇到错误。 这是代码:
OrientVertex ov = sm.getGraphdb().getVertex("12:1177");
Date d = new Date(2016, 7, 29);
Date dt =new Date(2016, 7, 29, 12, 0);
ov.setProperty("date", d);
ov.setProperty("datetime", dt);
...
当我 checkin 数据库时,我看到:
但是如果我用这个在数据库中存储日期:
update #12:1177 set fromODBDate = '2016-08-29'
我以正确的方式看待它。 有人知道哪里出了问题吗?
谢谢 马塞洛
最佳答案
你可以使用
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2000);
cal.set(Calendar.MONTH, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
Date d=new Date(cal.getTimeInMillis());
ov.setProperty("date", d);
希望对您有所帮助。
关于java - OrientDB:存储日期时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39205353/