I send this date from my controller in java (Spring-MVC
) the type in mysql
is datetime
@Temporal(TemporalType.TIMESTAM
To be more specific
time = new Date("2018-06-01 " + time);
var offset = time.getTimezoneOffset();
offset = Math.abs(offset / 60);
time.setHours(time.getHours() + offset);
in this case time is equal to hours with leading zeros:minutes with leading zeros. This will add the hours difference to the UTC. If you pass a string to date it is treated as UTC.