Open rcbandit111 opened 1 year ago
I have the following code that I want to migrate:
Gradle dependency:
implementation 'org.jadira.usertype:usertype.core:7.0.0.CR1'
Entity:
import org.joda.time.DateTime; @Entity @Table(name = "logs") public class Log { @Column(name = "inserted_date") @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime") private DateTime insertedDate; } ..... DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yy-mm-dd'T'HH:mm:ss'Z'"); log.setInsertedDate(DateTime.now()); dateFormatter.print(log.getInsertedDate().withZone(DateTimeZone.UTC)));
I updated the code to this:
import java.time.OffsetDateTime; @Entity @Table(name = "logs") public class Log { @Column(name = "inserted_date") private OffsetDateTime insertedDate; } ..... DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yy-mm-dd'T'HH:mm:ss'Z'"); log.setInsertedDate(OffsetDateTime.now()); dateFormatter.print(log.getInsertedDate().withZone(DateTimeZone.UTC)));
But I get error Cannot resolve method 'withZone' in 'OffsetDateTime'. Do you know what is the proper way to update method withZone?
Cannot resolve method 'withZone' in 'OffsetDateTime'
withZone
I have the following code that I want to migrate:
Gradle dependency:
Entity:
I updated the code to this:
Entity:
But I get error
Cannot resolve method 'withZone' in 'OffsetDateTime'
. Do you know what is the proper way to update methodwithZone
?