Agree with @DMehaffy - best to db timestamp in UTC+0 time.
I had to deal with timezones in my own app, and here’s some snippets I used to convert to the right timezones:
In my controller for posts in my Strapi app, using the SQL function AT TIME ZONE:
...strapi.connections.default.raw(`SELECT p.author, p.published_at AT TIME ZONE t.timezone) FROM posts p `);
I used Nuxt.js as frontend so I also use the native Javascript function Intl.DateTimeFormat() to format dates based on user’s browser timezone:
formatDate: (dateStr, string) =>
Intl.DateTimeFormat('en-GB', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
hourCycle: 'h12',
// hour12: true, // gives weird 00:11 pm for 12:11noontime
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
}).format(new Date(dateStr)),