As you would expect time zones within Plato ensure any dates & times presented within Plato are presented in the current users local time and not your servers local time.
To achieve this there are some important considerations...
Dates within Plato are stored within SQL Server using a DATETIME2 data type that represents the current system date and time including UTC offset of the underlying server on which SQL Server is running at the time the date was stored.
The server time zone can be adjusted via the general settings page and represents the time zone for your web server(s) location in the world.
For example if your web servers are located in Boston, USA you would select "(UTC-05:00) Eastern Time (US & Canada)" on the general settings page. If your web servers are located in London you would select "UTC+00:00) Dublin, Edinburgh, Lisbon, London" etc.
The server time zone is only applied to dates when displayed if users are not logged in or a logged in user has not provided any time zone information.
You've probably guessed it. The client time zone represents the users local time zone. Each user can edit there time zone via the "Settings" page accessible by clicking your avatar in the top right of every Plato page.
When dates are displayed within Plato the date is taken from the database. This includes the original UTC information added at the time of entry based on the SQL Servers underlying operating system regional settings.
If users are logged in and have provided time zone information we take the users UTC offset based on the time zone they provided and apply this offset to the original date returned from the database.
If a user is not logged in we do exactly the same but this time apply the UTC offset based on the server time zone set via the general settings page.
Let's say a date is stored in the Plato database like so 2019-08-17 23:57:04 -05:00. Notice the UTC offset applied by the date based on your underlying operating systems regional settings.
Let's say the user or client is based in London and has provided a time zone within there account of "UTC+00:00) Dublin, Edinburgh, Lisbon, London".
Plato will take the 2019-08-17 23:57:04 -05:00 date stored in your database without any changes and will calculate the users offset from the offset stored along with the date in your database. In this case the users offset would be +5:00.
Plato then simply applies +5:00 to the original date which is then displayed to the end user in there local time or in this case 2019-08-18 04:57:04 within the Plato user interface.
Looking at this another way lets say our stored date is 2019-08-17 23:57:04 +05:00 and the user has selected "(UTC-05:00) Eastern Time (US & Canada)" for there time zone. The calculated offset for this user would be -10:00 for the stored date so the displayed time the user would see would be there local time of 13:57:04.
The behaviour described above is all controlled via the
ILocalDateTimeProvider implementation within Plato. You can add your own implementation of this interface if you wanted to override our default behaviour.
If users are not authenticated we cannot determine the time zone for that user and as such all dates for anonymous users are displayed using the offset calculated from the server time zone you specify via the general settings page. Users must create an account, login and set there time zone to see local times.