How to save JS Date.now() in PostgreSQL?

前端 未结 3 2054
野的像风
野的像风 2021-02-04 01:17

I tried to use PostgreSQL timestamp datatype, but it throws an error

ERROR:  date/time field value out of range: \"1489849402536\"

3条回答
  •  伪装坚强ぢ
    2021-02-04 02:09

    Or you can do something similar to this:

    const time = new Date().toISOString();
    

    In your query builder:

    ...
    .update()
    .set({column_name: time})
    

提交回复
热议问题