-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
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:
Entity:
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?
Metadata
Metadata
Assignees
Labels
No labels