0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

指定タイムゾーンでデータを格納

Posted at
String dateTime= "2020-12-11T11:12"
LocalDateTime ldt = LocalDateTime.parse(dateTime);

int timeOffset= -9;//日本時間
DateTimeFormatter dtFt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm z")
                                             .withZone(ZoneOffset.ofHours(timeOffset));
String strToSave = ldt.format(dtFt);

PostgresSQLでデーターを保存時にtimestamp型コラムにwith time zoneを付く。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?