The timezone of a user is usually set based on
company.default.time.zone property set in
portal-ext properties file on first startup. However, if the time zone doesn’t follow the standard formatting for the Java time zone ID (for example, using
EST5EDT instead of
America/New_York), the default timezone of the company and the default Liferay user will be set to Samoa time. If nothing is set, the company default timezone is set to UTC. Since this is a “
company” property, once set in the database, this cannot be changed via the portal properties file.
The only way this can be changed is either by updating the control panel or by setting the timezone of the default Liferay user to the timezone of your choice in the database before the users are imported into Liferay.
If you have users that already exist in Liferay, their timezones will not be updated automatically even if you update the timezone via the control panel. Instead, you have to perform the following steps to fix the issue:
- Stop Liferay
- Set company.default.time.zone=America/New_York (if you are in Eastern time zone).
- Update the Users_ table in the Liferay database to set the timezone of the users that exist in the database to America/New_York
- Start Liferay up.
Once the changes are made, any new users imported/created in Liferay DXP will have their timezone set to the timezone of your choice.
Liferay DXP has many improvements and enhancements to the default functionality. With the latest changes, they have brought the timezone settings more in sync with the supported Java Timezone IDs.
If you have questions on how you can best leverage our expertise and/or need help with your Liferay DXP implementation, please leave your comments below, or reach out to us at https://www.xtivia.com/contact/ or firstname.lastname@example.org.
You can also continue to explore Liferay DXP by checking out The Top 10 New Features in Liferay DXP 7 from a functional perspective, or Top 5 New Features in Liferay DXP UI Development and Creating JAX-RS REST Services in Liferay DXP from a development perspective, or Top 5 DevOps Features in Liferay DXP from a DevOps perspective.