I am using jodatime for datetime. When I persist the date in mysql it stores 2015-09-04 10:30:18 instead of 2015-09-04 14:30:18. My timezone is GMT+4 or UAE. Do you know how to change the timezone? I try to put GMT+4 but it does not work. I run this line on mysql
select now()
and it gives me the correct date and time.
Entity class below:
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime", parameters = { @Parameter(name = "databaseZone", value = "UTC"), @Parameter(name = "javaZone", value = "jvm")})
@Column(name = "CURRENT_DATE")
@Basic(fetch = FetchType.EAGER)
@XmlElement
DateTime currentDate;
The problem is only when it saves the datetime in mysql. If I have to retrieve the date from mysql to do some calculation, the date is correct that it will be 2015-09-04 14:30:18. But when it will store , it is 2015-09-04 10:30:18.
Glad if you can help to sort this out.
Thanks