public inbox for [email protected]  
help / color / mirror / Atom feed
Re:  Retrieving current date
2+ messages / 2 participants
[nested] [flat]

* Re:  Retrieving current date
@ 2025-06-19 06:23 [email protected] <[email protected]>
  2025-06-19 14:10 ` Re: Retrieving current date Adrian Klaver <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: [email protected] @ 2025-06-19 06:23 UTC (permalink / raw)
  To: [email protected] <[email protected]>

Hello,May be a very basic question.  We all here are new to Linux / PostgreSQL
Ubuntu Server 22.04PostgreSQL 15PgAdmin4 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?
Happiness Always
BKR Sivaprakash


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Retrieving current date
  2025-06-19 06:23 Re:  Retrieving current date [email protected] <[email protected]>
@ 2025-06-19 14:10 ` Adrian Klaver <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Adrian Klaver @ 2025-06-19 14:10 UTC (permalink / raw)
  To: [email protected] <[email protected]>; [email protected] <[email protected]>

On 6/18/25 23:23, [email protected] 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
[email protected]







^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-06-19 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-06-19 06:23 Re:  Retrieving current date [email protected] <[email protected]>
2025-06-19 14:10 ` Adrian Klaver <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox