我有两列将 DateTime 值存储在 MySql 数据库中, 当我尝试从 Java 中的结果集中获取它们时,没有选项: getDateTime() 我应该使用 getDate() 还是行不通? 提前致谢 原文由 Luc 发布,翻译遵循 CC BY-SA 4.0 许可协议
Using getDate() only returns a Date , so in your case if you want both date and time use getTimestamp(String columnLabel) - That should work, also replace String columnLabel 使用数据库中的实际列名。 原文由 tmwanik 发布,翻译遵循 CC BY-SA 3.0 许可协议
Using
getDate()
only returns aDate
, so in your case if you want both date and time usegetTimestamp(String columnLabel)
- That should work, also replaceString columnLabel
使用数据库中的实际列名。