✅ Permanent Fix (Recommended)
Step 1. Find your PostgreSQL config file path

Run inside psql:

SHOW config_file;


Example output:

/etc/postgresql/16/main/postgresql.conf

Step 2. Edit the configuration

Open the file as superuser:

sudo nano /etc/postgresql/16/main/postgresql.conf


Find the line:

#timezone = 'Asia/Riyadh'


Uncomment and change to:

timezone = 'UTC'


Save and exit (Ctrl + O, Enter, Ctrl + X).

Step 3. Restart PostgreSQL service
sudo systemctl restart postgresql

Step 4. Verify it worked

Reconnect and run:

SHOW TIMEZONE;


✅ You should now see:

UTC








🛠️ Option 3: Change Linux system timezone permanently

If you want the whole server (not just Node) to use UTC:

sudo timedatectl set-timezone UTC


Then verify:

timedatectl


Output should show:

Time zone: UTC (UTC, +0000)


Now every service — PostgreSQL, Node.js, cron jobs, etc. — will run on UTC.

✅ Verify

Run again:

node -e "console.log(Intl.DateTimeFormat().resolvedOptions().timeZone)"


Output:

UTC



For windows locate file


"C:\Program Files\PostgreSQL\17\data\postgresql.conf"

and edit directly

