Addressing Issues Caused by Using a Non-GMT user.timezone

Liferay Support does not recommend or endorse specific third-party products over others. Liferay is not responsible for any instructions herein or referenced regarding these products. Any implementation of these principles is the responsibility of the subscriber.

As a best practice, it is strongly advised that all DXP and Portal instances set the time zones to GMT.  Otherwise, using non-GMT time zones has caused several known issues.

Therefore, this article is intended to help administrators modify their time zones at the JVM level to fix any issues if the JVM is not set to GMT. One particular issue was discovered where the DDM Date Fields are populated with the incorrect dates.

Liferay Support has provided several Groovy scripts that can be used to update the JVM with minimal impact. These scripts are also templates which can be adapted. System administrators should always verify the scripts first before executing them. Liferay Support provides the scripts only as a resource and is otherwise limited in assisting with implementing them.

Resolution

Steps to Execute in Liferay Portal 6.2

  1. Install a fix pack or a hotfix that incorporates the code changes in LPS-64179
  2. If possible, stop the application server and change the JVM settings to GMT (if stopping the server is not possible or feasible, then proceed to the next steps).
  3. Back up all data for recovery.
  4. Execute a script by navigating to Control Panel > Server Administration > Script tab. Select Groovy in the Language drop-down menu.
  5. In the Script window, enter the contents of the attached Groovy script. The script will adjust the DDM date fields from Journal Articles. Pay close attention to the following settings:
    //-----------------------------------------------------
    /*defaultTimeZoneID = "PST";*/
    defaultTimeZoneID = TimeZone.getDefault().getID();
    beginYear = 2016;
    beginMonth = 6; //STARTS IN 0
    beginDay = 8;
    beginHour = 0;
    beginMinutes = 0;
    endYear = 2016;
    endMonth = 6; //STARTS IN 0
    endDay = 14;
    endHour = 23;
    endMinutes = 59;
    //---------------------------------------------------
    
    
    • defaultTimeZoneID

      This is the original time zone that the system is changing from. In the script, it says PST. The script will convert all data to GMT / UTC.

    • beginYear, beginMonth

      This is the wrong start time frame to be converted.

    • endYear, endMonth

      This is the wrong end time frame to be converted.

  6. Once satisfied that the times are correct, you can opt to implement the changes immediately. To do this, there is a setting in the Groovy script you will need to modify:

    runDry =false;
    The default value is =true
  7. Execute the script. You will see messages in both the Control Panel and the console specifying that the dates and the number of Web Content articles have been modified. All content should have the correct time in UTC format.

DDM Templates

Some DDM templates show a date without a time zone. The Groovy script would be used only if you do not want to change user.timezone to GMT. To make the changes, shut down the server and restart the following set in the portal-ext.properties:

verify.frequency=-1

verify.processes=com.liferay.portal.verify.VerifyDynamicDataMapping

Steps to execute in DXP 7.1

  1. If possible, stop the application server and change the JVM settings to GMT (if stopping the server is not possible or feasible, then proceed to the next steps).
  2. Back up all data for recovery.
  3. Execute a script by navigating to Control Panel → Configuration → Server Administration → Script tab.
  4. Select Groovy in the Language drop-down menu.
  5. In the Script window, enter the contents of the Groovy script. If using Asset Entries, Message Boards or Web Content. Adapt the script accordingly.
  6. Click Execute.

Important Note: there are three scripts designed to run on DXP 7.1: AssetEntryTimezone, MessageBoardTimezone, and WebContentTimezone. All three have to be used at the same time or else it causes mismatches in the same database.

Additional Information

The Groovy Script referenced above is attached to this article and is to be used on Portal 6.2. 

See also: Issues with Setting Time Zone Settings on the JVM Level and LPS-64179.

Was this article helpful?
0 out of 0 found this helpful