![](/img/trans.png)
[英]How to compare the datetime of format "EEE MMM dd HH:mm:ss zzz yyyy" and "yyyy-MM-dd hh:mm:sss" in java?
[英]Joda DateTime format to yyyy-MM-DD HH:MM:SS
這是使用Joda DateTime獲取的DateTime格式2019-01-10T13:59:36.700+05:30
claimGroupingHistory.setCreatedAt(new DateTime());
但是在插入數據庫時出現以下錯誤
2019-01-10 13:59:36,754 [http-9292-1] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper: 146 - Data truncation: Incorrect datetime value: '\xAC\xED\x00\x05sr\x00\x16org.joda.time.DateTime\xB8<xdj[\xDD\xF9\x02\x00\x00xr\x00\x1Forg.joda.time.base.BaseDateTime\xFF\xFF\x' for column 'created_at' at row 1
我如何將Joda DateTime格式化為yyyy-MM-DD HH:MM:SS
這種格式插入數據庫
也許您應該使用Hibernate 3:
@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
在場上
對於Hibernate 4-5版,添加以下內容:
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
http://jadira.sourceforge.net/
https://mvnrepository.com/artifact/joda-time/joda-time-hibernate
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.