Timezone clarification

@Teodor can you clarify the new timezone options for me?

Using your example:

Example 1

Display the stored date & time to the user in the user’s time zone.
In order to display the date & time to the users in their time zone, then you need to set the:

  • Server Time Zone to UTC
  • Database Time Zone Handling to UTC

With setting as UTC as you describe, should I expect that time will be displayed in the timezone of the browser, without adding any offset manually?

I have a new project, and have confirmed it has Etc/UTC for db connection and docker settings (and the server settings as well) and time is currently shown exactly as it is in the database (UTC).

I’m using mySQL 8 in a docker container.

Thanks!

Maybe this doc will help you:

That is what I took the example from. :slight_smile:

The Example 1 says that to “display the date & time to the users in their time zone” use UTC rather than legacy.

But that does not work for me, so looking for confirmation that this is indeed intended to be the case.

1 Like

The datetime strings use the ISO 8601 notation. An UTC datetime string looks like 2023-01-11T12:00:00.000Z, Z is the zone designator for the zero UTC offset. Without the Z it would be seen as a local time, with local times the T is often replaced with a space like 2023-01-11 12:00:00.000.

When you use one of the date formatters on the client it will use the local timezone, when the datetime string didn’t contain timezone information it will be handled as if it were the local timezone. With UTC datetime strings (or any other timezone offset) it will convert it to the timezone of the client.

1 Like

That’s that part I was missing…it is the formatter that adjusts to local time.

Thanks for clarifying all that.

Hi Ken, feel free to edit the linked doc topic, to clarify the time usage as needed. It will be auto synced with our docs.

I have that permission?

@patrick I believe a bug with this:

Yes all the docs are wiki topics with nice version control, so you can edit

Hi there,
I’m trying to set my localhost (Mac M1) docker project (Node+BS5+Postgresql) and my production docker project (linode DE/Frankfurt) with Europe/Paris + Local referring to your How To post but it doesn’t work.
Any idea?
Thanks