Azure Database for PostgreSQL time not showing correctly

Johan van der Walt 11 Reputation points
2021-07-20T08:35:57.003+00:00

I was wondering if somebody here would be able to assist,
when running the query "SELECT NOW();" on Azure Database for PostgreSQL,
the value returned is not correct, I can see the time zone reflects correctly,
however the actual timestamp returned differs from the expected result.

is there any way I can change this?
I've tried to look for documentation online, but I've only found documentation relating to Azure SQL.

Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,846 Reputation points Microsoft Employee Moderator
    2021-07-20T23:27:49.117+00:00

    Hi @Johan van der Walt ,

    Thanks for using Microsoft Q&A !! I am getting the correct results on PostGreSQL server with SELECT Now();. What's the time/timezone you are expecting. Can you please provide a screenshot ?

    Also, you can check your current PostgreSQL server timezone setting using the below query:

    SELECT current_setting('TIMEZONE'); 116521-image.png

    If your timezone is not correct then you can use SET TIME ZONE to change it for specific region using the timezone abbreviation. Reference - SET TimeZone

    You can also use the below query to find list of available timezones - SELECT * FROM pg_timezone_names; 116523-image.png

    Other PostGreSQL documents you can refer to -

    Thanks Saurabh


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.