Prisma Date Day Off
Hello,
I currently have the following:
but the problem is that it saves the date as 2023-06-09 in the PostgreSQL database. Idk how to fix this
3 Replies
postgres saves time in the UTC +0 Timestamp
in your case the
new Date()
is auto timestamped to your local time, and when passing to postgres, it is converted from your local time to UTC
in which case it has a chance to go to the previous day
example if you life in UTC+2 and run the insert statement at 10 June 2023, 01:00 AM
, when passing to postgres it is converted to 09 June 2023, 11:00 PM
as UTC
is behind by 2 hours
so to fix it just timestamp your dateAh okay, thanks
Solution
I just added
UTC
after the day, got fixed, thanks 🙂