Home > Back-end >  Postgres: Display timestamp in specific UTC format
Postgres: Display timestamp in specific UTC format

Time:09-22

I have a timestamp stored this way in database:

2021-08-14 12:19:58 00

I need to display it in this format

2021-08-14 12:19:58 UTC

CodePudding user response:

Use the to_char function with the TZ format:

SELECT to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS TZ');

         to_char          
══════════════════════════
 2021-09-21 23:06:15 CEST
(1 row)
  • Related