# PostgreSQL how to convert t\_stamp (bigint type) into PST timestamp (Resolution)

**URL:** <https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546>\
**Category:** General Discussion\
**Created:** [August 8, 2023, 12:31am UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546 "2023-08-08T00:31:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [August 8, 2023, 12:31am UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546/1 "2023-08-08T00:31:07Z")

</div>

I am trying to convert the t\_stamp column to US Pacific datetime (from a historical data table)  
I have been trying to use an examples from this page [https://www.appsloveworld.com/postgresql/100/10/how-to-cast-bigint-to-timestamp-with-time-zone-in-postgres-in-an-update](https://www.appsloveworld.com/postgresql/100/10/how-to-cast-bigint-to-timestamp-with-time-zone-in-postgres-in-an-update)  
So far, this is working for me:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef883281e36b96f2be4174df57094a504c18a976.png)

Does anyone know of a better approach?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 8, 2023, 12:44am UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546/2 "2023-08-08T00:44:13Z")

</div>

Looks correct to me. You're converting from a Java epoch timestamp (an unzoned instant-in-time, in milliseconds) to a Postgres timestamp-with-timezone (also representing an instant-in-time, at UTC), to a local timezone.

What do you think is wrong with what you have?

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [August 8, 2023, 12:50am UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546/3 "2023-08-08T00:50:48Z")

</div>

Hi. Thank you. Acually, this post was more like a resolution. But I was curious if there's still a better way. Thanks for your response.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 8, 2023, 12:12pm UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546/4 "2023-08-08T12:12:50Z")

</div>

> [@Lalillo1](#):
>
> a better way

Yes, just convert it to a timestamp without selecting a timezone. `to_timestamp()` yields a timestamptz, which will be handed over to Ignition efficiently and correctly, for Ignition to handle timezones naturally, on a client-by-client basis.

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [August 10, 2023, 3:17am UTC](https://forum.inductiveautomation.com/t/postgresql-how-to-convert-t-stamp-bigint-type-into-pst-timestamp-resolution/77546/5 "2023-08-10T03:17:20Z")

</div>

Hi. Noted. Thank you very much for your help.
