S
Supabase•3y ago
alx90

update_at timestamp?! How To?

Hey guys, I have a column which have the type timestampz. I try to fill the field like:
payload.updated_at = new Date()
//OR
payload.updated_at = new Date().toISOString()
//both is not working
payload.updated_at = new Date()
//OR
payload.updated_at = new Date().toISOString()
//both is not working
Im getting the following error:
{
code: '22007',
details: null,
hint: null,
message: 'invalid input syntax for type timestamp with time zone: "6. September 2022, 17:21"'
}
{
code: '22007',
details: null,
hint: null,
message: 'invalid input syntax for type timestamp with time zone: "6. September 2022, 17:21"'
}
2 Replies
garyaustin
garyaustin•3y ago
new Date().toISOString() is the correct format for timestamp and timestamptz columns. Note you can also just put default to now() in the dashboard table UI.
alx90
alx90OP•3y ago
Thanks Mate! Yeah the issue was another 😄 I forgot a data field 🤡 But yeah the now() variant will be the best I think 😄

Did you find this page helpful?