Font Size:

Configuring Joget for UTC DateTime Storage

Overview

To ensure consistent DateTime values across the JRE, database, and log files, Joget DX can be configured to store DateTime as Coordinated Universal Time (UTC). This setup ensures consistency regardless of the server or client's physical location or time zone.

Benefits of Using UTC

Time Zone Independence: UTC eliminates ambiguity when users or servers operate in different time zones, ensuring consistent timestamps across systems.

Distributed Systems: In environments with multiple servers in different regions, using UTC prevents conflicts and ensures accurate synchronization.

Avoid DST Issues: Daylight Saving Time (DST) introduces time shifts that can disrupt scheduling and timestamps. UTC avoids these issues entirely.

Configuring Joget for UTC

To configure Joget for UTC, add the -Duser.timezone=UTC parameter in the JAVA_OPTS variable:

  1. Navigate to the Joget DX installation page. The default location is as follows: C:\Joget-DX8-Enterprise.
  2. Right-click the joget-start batch file and click Edit in Notepad.
  3. Add the following script to the batch file: -Duser.timezone=UTC.
set JAVA_OPTS=-Xmx2048M -Dwflow.home=./wflow/ -javaagent:./wflow/aspectjweaver-1.8.5.jar -Duser.timezone=UTC -javaagent:./wflow/glowroot/glowroot.jar

This sets the default time zone for the JVM running Joget. Consequently, all system DateTime fields in the database, such as dateCreated and dateModified, stores timestamps in UTC.

Viewing UTC Settings in Joget

Import the attached APP_Date_Time_In_UTC_Demo3.jwa app to view all the settings required for UTC. In the App Composer, open the following:

  1. Form Builder:

    1. Navigate to Form Builder and click Date Picker.

    2. In the Field Type drop-down list, select the Date and Time stored in UTC option.

    3. Under Advanced Options, enable the 24 Hours Format option.

    4. Set default value to #date.yyyy-MM-dd HH:mm|8#.

    Note: You can change the |8 to |-5 for EST.
  2. List Builder:

    1. Navigate to List Builder > Column Date Picker > Formatter > Date and disable the Date Stored in UTC Timezone checkbox.

    2. If date filters are used, disable this same checkbox in the date and date range filters.

  3. Setup Users:

    1. In the Admin Bar, navigate to Users > Setup User and click a user in the list.

    2. Click Edit User

    3. For Time Zone, set the respective country time zone of the Joget users (e.g., EST). Joget displays all dates in EST.

    4. Click Save.

With the above UTC setting, here are the DateTime stored and displayed respectively in Joget DX 8:

  • System clock: 2025-01-03 15:23:00 (my TZ GMT+8)

  • Database dateCreated: 2025-01-03 07:23:00

    • Datalist display: 03-01-2025 03:23 PM (using date formatter)

  • Database Date Picker: 2025-01-03 07:23

    • Datalist display: 03-01-2025 03:23 PM (using date formatter)

Additional Considerations

When using UTC, consider the following:

  • Converting existing database records to UTC.

  • Making extensive changes to the existing app to enable the Date Stored in UTC Timezone checkboxes in Forms and Lists.

Perform diligent testing on UTC settings in a development server before implementing the changes live. Always back up your database daily.

For more information, visit Date Picker.

Download sample app

Download the demo app for Display Joget DX 8 date and time in UTC:
Created by Debanraj Last modified by Aadrian on Feb 19, 2025