-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert date as UTC #424
Comments
Hey could you share more info on how you're inserting? The value , query, etc? |
I don't know any way to do this, I have nothing to share. |
The query statement and code you're using with the values that are not showing up as UTC in your database is a good start. |
INSERT INTO test_table (date_column)
VALUES ($1); Where the parameter is a JavaScript The appropriate time zone to use is unknown as the |
Hmmm, I think the issue is that the JS date object stores dates in UTC, but with the offset of your client app's local timezone in the value, while your DB server is using another timezone (probably true UTC +0). I've seen this before and could only make it bearable to work with using a library like Dayjs, Moment, or Luxon that creates timezone-aware dates that take into account your local timezone when creating actual UTC dates. |
That's right, aye. I was unable to find a way to insert a date with a specific timezone with this library. |
Hello!
I've some Date objects that I wish to insert into a
timestamp without time zone
column, but when I insert them they get recorded using my locale timezone. How can I insert them using UTC instead?Thanks,
Louis
The text was updated successfully, but these errors were encountered: