Re: Retrieving current date

From: "sivapostgres(at)yahoo(dot)com" <sivapostgres(at)yahoo(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Subject: Re: Retrieving current date
Date: 2025-06-20 11:08:41
Message-ID: 2120898981.577779.1750417721559@mail.yahoo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks all,
I just changed the timezone setting in postgresql.conf file.  That resolved this issue.

On Thursday 19 June, 2025 at 07:41:16 pm IST, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:

On 6/18/25 23:23, sivapostgres(at)yahoo(dot)com wrote:
> Hello,
> May be a very basic question.  We all here are new to Linux / PostgreSQL
>
> Ubuntu Server 22.04
> PostgreSQL 15
> PgAdmin4 6.16
>
> When I run the following query in pg_admin
>
> Select today_now
> From   (Select localtimestamp(0) as today_now) a;
>
> I get UTC time and not the IST time, which I expect.
>
> How to change the setting(s), if any, to retrieve the current date and
> time in IST?

For setting see:

https://www.postgresql.org/docs/current/runtime-config-client.html

"TimeZone (string)

    Sets the time zone for displaying and interpreting time stamps. The
built-in default is GMT, but that is typically overridden in
postgresql.conf; initdb will install a setting there corresponding to
its system environment. See Section 8.5.3 for more information.
"

For a quick fix, maybe?:

select localtimestamp(0) at time zone 'Asia/Kolkata' as today_now;

>
> Happiness Always
> BKR Sivaprakash
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Röthlisberger 2025-06-20 11:49:41 undefined symbol: PQcancelStart
Previous Message Tomas Vondra 2025-06-20 09:11:47 Re: Extension disappearing act