# Time format error when inserting into Database

**URL:** <https://forums.losant.com/t/time-format-error-when-inserting-into-database/5604>\
**Category:** Help\
**Tags:** workflow\
**Created:** [September 18, 2024, 8:40am UTC](https://forums.losant.com/t/time-format-error-when-inserting-into-database/5604 "2024-09-18T08:40:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subrahmanyam\_Jonnala](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Subrahmanyam\_Jonnala](https://forums.losant.com/u/Subrahmanyam_Jonnala)\
**Post date:** [September 18, 2024, 8:40am UTC](https://forums.losant.com/t/time-format-error-when-inserting-into-database/5604/1 "2024-09-18T08:40:51Z")

</div>

Hi All,

I am trying to insert workflow time into timescaledb. The column defined as timestamptz. but for some reason, when i insert the format is changing and throwing error. Need help on this,

![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/2/2254cef8fd0936c69ac1dd487afac2d94c918e2c.png)

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [September 18, 2024, 11:58am UTC](https://forums.losant.com/t/time-format-error-when-inserting-into-database/5604/2 "2024-09-18T11:58:32Z")

</div>

The `time` property on the initial payload is a [JavaScript Date Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). You can pass that as an argument to either the [Date/Time Node](https://docs.losant.com/workflows/logic/date-time/) or the [`{{formatDate}}` Handlebars helper](https://docs.losant.com/workflows/accessing-payload-data/#formatdate-val-formatstr-tzutc-localeen) to convert it to whichever format that column in your database expects. I’m assuming you do not actually want to store it as the [stringified date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toString) but rather as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) or as an [ISO string](https://en.wikipedia.org/wiki/ISO_8601).
