Reputation: 2132
I want to insert current timestamp without timezone to Supabase.
I know I can set default value of the timestamp column to NOW()
but
there can be some delay in the timing and I need it precise.
I have tried Date.now()
but got the error: date/time field value out of range
How can this be done?
Upvotes: 5
Views: 8715
Reputation: 1841
You can insert the time from javascript by setting
new Date().toISOString();
when doing an insert or update. I want to address the first part of your statement though as the precise time is the time that data hits the server so having NOW()
as the default value in Postgres is more accurate than you passing the date over the wire in my opinion.
Upvotes: 8