# Postgres output differ between bash and SQL exec. node

**URL:** <https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116>\
**Category:** Questions\
**Created:** [August 27, 2025, 11:15pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116 "2025-08-27T23:15:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkuluk](https://avatars.discourse-cdn.com/v4/letter/u/958977/32.png) [@utkuluk](https://community.n8n.io/u/utkuluk)\
**Post date:** [August 27, 2025, 11:15pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/1 "2025-08-27T23:15:40Z")

</div>

I am in Istanbul (UTC+3),  
it’s 02:08, so the date is 28/08/2025.  
But in UTC it’s still 27/08/2025 of course.

`“SELECT NOW()::date;”`

In postgres (bash) this returns 28/08,  
in n8n postgres SQL execution node, it returns 27/08.

Every TZ settings I could find (in ubuntu, docker, n8n, postgres) is set to Europe/Istanbul, but this is the result.

Maybe it’s something simple,  
I don’t know, just wanted to report this.

- \*\*n8n version: Latest (\*\*1.108.2, **just updated)**
- **Database: postgres:15-alpine**
- **Running n8n via: Docker compose**
- **Operating system: Ubuntu 22.04 (remote server)**

---

<div class="post-metadata">

**Author:** ![jabbson](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jabbson/32/87328_2.png) [@jabbson](https://community.n8n.io/u/jabbson)\
**Post date:** [August 27, 2025, 11:31pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/2 "2025-08-27T23:31:11Z")

</div>

Run this in execute statement postgres in n8n

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/c/9/c93a2bf299feacc167c32768a9b1d25b73098783.png)

you will most likely see UTC.

Now run this to get the NOW with the timezone shift:

![image](https://europe1.discourse-cdn.com/n8n/optimized/3X/6/f/6f36153d47b5159fa2af142b91cc807e7dea30cc_2_345x24.png)

or run this is you select NOW many times in the statment:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/d/4/d480797629a084ad4347fb84cff7a1f989284f4f.png)

---

<div class="post-metadata">

**Author:** ![utkuluk](https://avatars.discourse-cdn.com/v4/letter/u/958977/32.png) [@utkuluk](https://community.n8n.io/u/utkuluk)\
**Post date:** [August 28, 2025, 8:18am UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/3 "2025-08-28T08:18:20Z")

</div>

```auto
SHOW timezone;
SELECT current_setting(‘TimeZone’);
SELECT NOW(), CURRENT_DATE;
SELECT (NOW() AT TIME ZONE ‘Europe/Istanbul’)::date;

```

Result of this is (in n8n):

```auto
[
  {
    "TimeZone": "Europe/Istanbul"
  },
  {
    "current_setting": "Europe/Istanbul"
  },
  {
    "now": "2025-08-28T08:11:00.437Z",
    "current_date": "2025-08-27T21:00:00.000Z"
  },
  {
    "timezone": "2025-08-27T21:00:00.000Z"
  }
]

```

And the result in postgres bash:

```auto
n8n=# SHOW timezone;
    TimeZone     
-----------------
 Europe/Istanbul
(1 row)

n8n=# SELECT current_setting('TimeZone');
 current_setting 
-----------------
 Europe/Istanbul
(1 row)

n8n=# SELECT NOW(), CURRENT_DATE;
              now | current_date 
-------------------------------+--------------
 2025-08-28 11:13:42.502521+03 | 2025-08-28
(1 row)

n8n=# SELECT (NOW() AT TIME ZONE 'Europe/Istanbul')::date;
  timezone  
------------
 2025-08-28
(1 row)

```

So in bash, it’s what it supposed to be.  
But in n8n node, it’s different.

Now the other part (in n8n):

```auto
SET TIME ZONE 'Europe/Istanbul';
SELECT NOW()::date;
SELECT NOW()::date;
SELECT NOW()::date;

```

The result of this (in n8n):

```auto
[
  {
    "now": "2025-08-27T21:00:00.000Z"
  },
  {
    "now": "2025-08-27T21:00:00.000Z"
  },
  {
    "now": "2025-08-27T21:00:00.000Z"
  }
]

```

And the result in postgres bash:

```auto
n8n=# SET TIME ZONE 'Europe/Istanbul';
SET
n8n=# SELECT NOW()::date;
    now     
------------
 2025-08-28
(1 row)

n8n=# SELECT NOW()::date;
    now     
------------
 2025-08-28
(1 row)

n8n=# SELECT NOW()::date;
    now     
------------
 2025-08-28
(1 row)

```

But later I thought:  
Maybe it’s because I have created the database (a month ago) before I set the timezone settings in docker, postgres, n8n, ubuntu etc. (1-2 days ago).

---

<div class="post-metadata">

**Author:** ![jabbson](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jabbson/32/87328_2.png) [@jabbson](https://community.n8n.io/u/jabbson)\
**Post date:** [August 28, 2025, 2:36pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/4 "2025-08-28T14:36:00Z")

</div>

I see, thank you for running these tests.

So,… I think the “difference” could be not about Postgres time zone; but rahter about client-side JSON rendering of date-like values.

Let’s try to avoid it.

When you want a **calendar date** (not a timestamp), return **TEXT** , not a date/timestamp type. E.g.:

- Always-robust, ignores session tz, returns a plain string:

![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/b/5b3f980b8240deda0a6f5086acb6245fd53cb630.png)

result will be

```auto

[
  {
    "local_date": "2025-08-28"
  }
]

```

- Or, if you trust the session tz already set to Europe/Istanbul:

![image](https://europe1.discourse-cdn.com/n8n/original/3X/f/0/f03a79ae7c480606699cdc7310fb9eea08653af5.png)

- If you need midnight as a local timestamp string (not shifted to Z):

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/e/1/e159efa121e3be19ca3209ff1c3b2ad5bd728c98.png)

Now,… if you must keep timestamps:

Return them as **strings** in the target timezone to avoid automatic UTC normalization:

![image](https://europe1.discourse-cdn.com/n8n/original/3X/7/1/71bbabfdc3719ca4de4f5560040e930ae725afc6.png)

Quick sanity checks you can run in n8n:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/e/a/ea9d523992f3de46d509c67f8d8a64055809806f.png)

which for me returns (should be slightly different for you):

```auto
[
  {
    "tz": "UTC",
    "now_timestamptz": "2025-08-28T14:30:21.925Z",
    "now_local_ts": "2025-08-28T17:30:21.925Z",
    "local_date_text": "2025-08-28"
  }
]

```

You’ll see `now_timestamptz` end with `Z` (UTC JSON), while `local_date_text` is the human date you expect (`2025-08-28`) with no timezone juggling.

The bottom line: your DB is fine I think and on `Europe/Istanbul`. n8n is **displaying** date-like values in UTC. Return **formatted text** for dates (or any time you care about a specific local representation) to make the result unambiguous.

Sorry about screenshots, the forum would let me paste SQL… ugh.

---

<div class="post-metadata">

**Author:** ![utkuluk](https://avatars.discourse-cdn.com/v4/letter/u/958977/32.png) [@utkuluk](https://community.n8n.io/u/utkuluk)\
**Post date:** [August 28, 2025, 2:57pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/5 "2025-08-28T14:57:08Z")

</div>

Thanks for support.

TO\_CHAT() actually solves it, I know, an LLM told me about it and I trired. But I thought maybe something is wrong with the n8n’s handling, so I just wanted to write about it here more like a feedback.

---

<div class="post-metadata">

**Author:** ![jabbson](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jabbson/32/87328_2.png) [@jabbson](https://community.n8n.io/u/jabbson)\
**Post date:** [August 28, 2025, 3:00pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/6 "2025-08-28T15:00:16Z")

</div>

Hope this was helpful (if if was, kindly mark one of the answers as solution and thank you). Optionally, you may want to also open a bug about about client-side JSON rendering of date-like values in n8n and provide an example of how it does work and how you expect it to (bugs can be opened [here](https://github.com/n8n-io/n8n/issues/new?labels=bug-report&body=%0A%3C%21--+Please+follow+the+template+below.+Skip+the+questions+that+are+not+relevant+to+you.+--%3E%0A%0A%23%23+Describe+the+problem%2Ferror%2Fquestion%0A%0A%0A%23%23+What+is+the+error+message+%28if+any%29%3F%0A%0A%0A%23%23+Please+share+your+workflow%2Fscreenshots%2Frecording%0A%0A%60%60%60%0A%28Select+the+nodes+on+your+canvas+and+use+the+keyboard+shortcuts+CMD%2BC%2FCTRL%2BC+and+CMD%2BV%2FCTRL%2BV+to+copy+and+paste+the+workflow.%29%0A%E2%9A%A0%EF%B8%8F+WARNING+%E2%9A%A0%EF%B8%8F+If+you+have+sensitive+data+in+your+workflow+%28like+API+keys%29%2C+please+remove+it+before+sharing.%0A%60%60%60%0A%0A%0A%23%23+Share+the+output+returned+by+the+last+node%0A%3C%21--+If+you+need+help+with+data+transformations%2C+please+also+share+your+expected+output.+--%3E%0A%0A%0A%23%23+Debug+info%0A%0A%23%23%23+core%0A%0A-+n8nVersion%3A+1.108.2%0A-+platform%3A+docker+%28self-hosted%29%0A-+nodeJsVersion%3A+22.17.0%0A-+database%3A+postgres%0A-+executionMode%3A+regular%0A-+concurrency%3A+-1%0A-+license%3A+enterprise+%28production%29%0A%0A%23%23%23+storage%0A%0A-+success%3A+all%0A-+error%3A+all%0A-+progress%3A+false%0A-+manual%3A+true%0A-+binaryMode%3A+filesystem%0A%0A%23%23%23+pruning%0A%0A-+enabled%3A+true%0A-+maxAge%3A+336+hours%0A-+maxCount%3A+10000+executions%0A%0A%23%23%23+client%0A%0A-+userAgent%3A+mozilla%2F5.0+%28macintosh%3B+intel+mac+os+x+10_15_7%29+applewebkit%2F537.36+%28khtml%2C+like+gecko%29+chrome%2F139.0.0.0+safari%2F537.36%0A-+isTouchDevice%3A+false%0A%0AGenerated+at%3A+2025-08-27T23%3A24%3A49.340Z%7D)).

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [September 4, 2025, 3:01pm UTC](https://community.n8n.io/t/postgres-output-differ-between-bash-and-sql-exec-node/177116/7 "2025-09-04T15:01:04Z")

</div>

Closed on September 4, 2025, 3:01pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
