Modifying the time zone settings at the JVM level (setenv.bat
or setenv.sh
in tomcat) will affect all of the processes run in that JVM.
This article describes several known issues that may be experienced if the time zone is not set to GMT at the JVM level.
Resolution
1. The Calendar Portlet May Not Function Correctly
When the time zone is NOT set to GMT at JVM level, the Start Date and End Date of the all day events exported from the Calendar portlet might display the incorrect date after the exported .ics files are imported to Microsoft Outlook. The root cause is that changing the time zone at the JVM level will cause the portal to wrongly calculate the Start Date and End Date of the all day events.
Also, another related issue can be found at LPS-33526.
2. Web Content Created Using Structures That Have the Date Fields Will Display Incorrect Dates After Publishing
When the time zone is NOT set to GMT at JVM level, for example, it is configured to -Duser.timezone = Europe/Berlin, the web contents created using structures that have the Date fields will display incorrect dates after publishing.
- Configure the setenv appropriate for your environment so that the -Duser.timezone equals Europe/Berlin, like so:
-Duser.timezone=Europe/Berlin
- Start Liferay
- Go to Admin > Site Administration > Content > Web Content
- Add a new structure that includes a Date field and assign it to a template
- Create a new article with the structure and template created in step 4, choosing a date for the Date field
After publication, see that the date is set to the day BEFORE the one set in step 5.
In summary, each date stored in the portal's database is (must be) stored in GMT time. When the portal needs to display one stored date to the end users, the portal then calculates the display date based on the current date of the application server (this date is affected by the configured JVM level time zone) and the stored GMT format date. In order to make sure the display date is calculated correctly, the time zone must be configured to GMT at the JVM level. Otherwise, it will result in incorrect time zone offset and then cause the display date to be wrongly calculated and displayed.