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

前端 未结 3 2060
野的像风
野的像风 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:22

    Just in case you are using Sequelize, you can use: sequelize.literal('CURRENT_TIMESTAMP'). Example:

    await PurchaseModel.update( {purchase_date : sequelize.literal('CURRENT_TIMESTAMP') }, { where: {id: purchaseId} } );
    

提交回复
热议问题