Is there a way to change timezone for a session

Hi everyone!
I’m using Neon in my Next.js application with chatbot and I store all of my date related data in UTC timezone. However, I’ve got a time where I want to retrieve all of my data in EST timezone. And I don’t want to specify it in query every time. I found a nice solution that seems great for me. I can set timezone for one connection specificaly with SET TIME ZONE 'EST';

I’m trying to do the same thing with Neon and my Next.js appliction. One thing is that I can’t understand where to place this logic. Is there anyone who can help with that?

Here’s the example of code that I was trying to use but it didn’t help

import { sql } from "@vercel/postgres";

sql.query("SET TIME ZONE 'EST'");
sql.query("RESET TIME ZONE");
1 Like

I have the same problem :eyes::point_up:


Vercel driver uses Neon serverless driver under the hood in the mode where each query is submitted as a separate http call ( That means that there is no session semantics as each new query may use a different database connection.

I can suggest two workarounds:

@Stas_Kelvich That’s very helpfull. Thank you very much