Date Formatter

The Date Formatter in Joget allows you to transform the existing date format to another date format for datalist display. This feature helps in displaying dates in a more readable and user-friendly format.

Configure date

To add this Formatter, go to the element's properties under Formatter and choose Date in the Formatter field.

When adding Date, you will see the following fields available for configuration:

  • Date stored in UTC timezone: Click this checkbox if you store dates in the database in UTC timezone.
  • Data Date Format: Set to follow your Joget System Settings > System Date Format, for example, dd-MM-yyyy hh:mm aa. Use the Java date format. For instance, yyyy-MM-dd for 2022-06-20. See the Date Format Pattern Syntax documentation for a list of date formats.
  • Display Date Format: Use Java date format. For instance, dd/MM/yyyy for 20/06/2022. See the Date Format Pattern Syntax documentation for a list of date formats.
    When this field is left empty, the following will be considered:
    • If the current locale starts with zh, the format will be set as yyyy-MM-dd.
    • If Using Locale Date Format is set in General Settings, the date format will be used based on the current user's locale.
    • Otherwise, it will use MM/dd/yyyy.

Usage Example

We will format the column Date Created (dateCreated in the database table) to another date format in the datalist builder.

  1. The Data Date Format should be based on the data list preview from the builder. This may also be subject to the system locale and date format attributes set in the System Settings. See Server Locale and Time Zone for more information.
  2. In this example, without using Date Formatter, the Data Date Format would be in the Java date format of dd-MM-yyyy hh:mm aa.
  3. Using the Date Formatter, we will change the Display Date Format to the Java date format of hh:mm aa dd/MM/yyyy.
    Note that this setting does NOT change the date's formatting but merely how it is displayed.
  4. After configuration, you can see the result in the datalist preview and during runtime.
Download the demo app for Date Formatter:
Created by Julieth Last modified by Aadrian on Dec 13, 2024