5
1

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.

PostgresのSQLでUTCの現在時刻を取得したい

Posted at

current_timestamp at time zone 'UTC'が正解っぽいかな
(DB接続のtimezoneがAsia/Tokyoな環境)

select
	localtimestamp a,
	localtimestamp at time zone 'UTC' b,
	localtimestamp at time zone 'Asia/Tokyo' c,
	current_timestamp d,
	current_timestamp at time zone 'UTC' e,
	current_timestamp at time zone 'Asia/Tokyo' f

image.png

5
1
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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?