0

I'm storing sales date as UTC in TIMESTAMP column in mysql table.

users around the world need to show sales in their settings based timezone

how to set timezone for each user request using mysql2 npm package?

jafar
  • 15
  • 4

1 Answers1

0

You can use CONVERT_TZ in your sql request like this:

//CONVERT_TZ (dt, from_tz,to_tz)
SELECT CONVERT_TZ('2008-05-15 12:00:00','+00:00','+10:00') as required_datetime";

for details visite the link CONVERT_TZ

For information I prefer to use moment.js

Fabrice Fabiyi
  • 351
  • 6
  • 17