Next.js Discord

Discord Forum

What is the best way to return data from a database based on local time zone?

Unanswered
Dwarf Hotot posted this in #help-forum
Open in Discord
Dwarf HototOP
Right now I'm automatically storing data in my vercel database with a created_at column.

This is in pdt since I'm in pdt. However, when I fetch data using Date() function in my sql query, it automatically converts the data to utc.

This is causing my data to get moved forward 7 hours and not show up for today's date once it's stored after 5pm pdt. What is the most straight forward approach to solving this issue?

0 Replies