How to set the necessary timezone in LocalTime

Oleksiy Zhurko :

I have a database which has a movie schedule. Well, of course there are two such columns:

...
start_at TIME NOT NULL,
end_at   TIME NOT NULL,
...

I have entity in java code:

@Entity
@Table(name="tableName")
public class HallMoviesSchedule {

    ...
    @Column(nullable = false, name = "start_at")
    @DateTimeFormat(iso = DateTimeFormat.ISO.TIME)
    private LocalTime startAt;

    @Column(nullable = false, name = "end_at")
    @DateTimeFormat(iso = DateTimeFormat.ISO.TIME)
    private LocalTime endAt;
    ...

}

But pulling information to my web page gives one hour less than is in the database for my region. How can this be fixed?

oleg.cherednik :

LocalTime does not have TimeZone. You have to use ZonedDateTime instead.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=396303&siteId=1