我在postgres有一个字段
Column | Type
created_at | timestamp without time zone
我在Java中将unix时间戳存储在long中
long createdAtTime = data.getcreatedAtTime();
我想将它转换为java中的时间戳,这样我就可以用activejdbc将其存储到postgres中。
我尝试了以下几种方法
Date convertedTime = new Date(createdAtTime*1000L);
record.set("created_at", convertedTime);
record.saveIt();
但我得到以下错误:
Can't infer the SQL type to use for an instance of java.util.Date. Use setObject() with an explicit Types value to specify the type to use.
我应该先使用不同的方式转换日期吗?
https://stackoverflow.com/questions/27531844
复制相似问题