Changing time zone settings in Drupal 8

You are able to alter the Time Zone setting for your Drupal 8 site within the Admin area. In fact, users are also able to alter the Time Zone for their specific accounts as well. This is helpful because the dates that are displayed across the site on articles, log posts, comments, etc will be relevant to the visitor’s local time. Check out the quick guide below as we show you how to change the Time Zones in Drupal 8.

How to change the time zone setting in Drupal 8

  1. Log into the Drupal 8 admin interface.
  2. Using the top menu bar, click on the Menu option.

  3. This leads to a second menu bar appearing under the first. From here, click on the Configuration tab.

  4. Look for the Regional and Language category and then click on the Regional Settings option.

  5. Here you will see a dropdown from which you will select your site’s default time zone.

  6. Once you have selected the preferred time zone, click on the Save Configuration button at the bottom to activate your changes.

    Below is a couple of shots that demonstrate how the time display changes. The first is when the setting is for American West Coast time, and the second is when it is set to American East Coast time.

    Before After

Giving the user their own time zone

In addition to setting your time zone for the site, there is a checkbox named Users may set their own time zone which you can activate to allow users to have their own time zone. By selecting this checkbox, other options will appear that you can use to tailor the user’s experience as well.

Users may set their own time zone This box MUST be checked for any of the other options to appear
Remind users at login if their time zone is not set If this is checked, the user will be reminded at login to set their own time zone. If they do not, then the default will be used
Time Zone for new users These options will set the time zone for new members according to the following radio buttons:

Default time zone This will use the time zone set for the site itself

Empty time zone The user will have no time zone set for the account.
Users may set their own time zone at registration User will be able to select their own timezone

Thoughts on “Changing time zone settings in Drupal 8

  • On a fully updated Drupal 8/CiviCRM 5 running on CentOS 7, using MariaDB 10 with a fairly standard setup:

    $ mysql_tzinfo_to_sql /usr/share/zoneinfo/right |mysql -u root mysql -p

    Was the only solution, which I could figure out, that worked. Following this timezone file path update, the time zone in CiviCRM matched the timezone I’m in. I think the default MariaDB setup simply uses a path that doesn’t match CentOS’ timezone file location.

    -Neil

Leave a Reply