Locale date in Composite project

Hi
I have put in the following code in the application properties in order to have the expected date format in my application but it still shows in different format:

#Locale specific formating
jmix.ui.dateFormat=dd/MM/yyyy
jmix.ui.dateTimeFormat=dd/MM/yyyy hh:mm a
jmix.ui.timeFormat=hh:mm a
jmix.core.locale = en

Thanks in advance for your help

Hello!

Try these message keys:

# Date formats
dateFormat=dd/MM/yyyy
dateTimeFormat=dd/MM/yyyy HH:mm
timeFormat=HH:mm
offsetTimeFormat=HH:mm Z
offsetDateTimeFormat=dd/MM/yyyy HH:mm Z

See jmix/jmix-translations/content/io/jmix/core/messages.properties at master · jmix-framework/jmix · GitHub

Hi Roman
Thank you. But this is not working for me for any unknown reason. When I have a composite project, do I need to put it in all add-ons or somewhere centrally?

Since my one is composite project, first I tried to use the code in the message.properties in the main application and then also used in the module I have target for this.

xml file

<columns resizable="true">
                            <column property="employeeProfile.employeeCode" key="employeeCode" autoWidth="true" frozen="true"/>
                            <column property="employeeProfile.name" key="name" autoWidth="true"/>
                            <column property="attenDate" autoWidth="true"/>
                            <column property="dayName" autoWidth="true"/>
                            <column property="attendanceDayType" autoWidth="true"/>
                            <column property="attenStatus" autoWidth="true"/>
                            <column property="entryTime" autoWidth="true"/>
                            <column property="exitTime" autoWidth="true"/>
                            <column property="entryDate" autoWidth="true"/>
                            <column property="exitDate" autoWidth="true"/>
                            <column property="workShift" autoWidth="true"/>

field data type
image

message.properties

# Date formats
dateFormat=dd/MM/yyyy
localDateFormat=dd/MM/yyyy
dateTimeFormat=dd/MM/yyyy HH:mm
localDateTimeFormat=dd/MM/yyyy HH:mm
timeFormat=HH:mm
localTimeFormat=HH:mm
offsetTimeFormat=HH:mm Z
offsetDateTimeFormat=dd/MM/yyyy HH:mm Z

This is how it is displayed incorrectly.
image

If you want to display time in a 12-hour format, you should add ‘a’ to the format string. In my previous post, I only mentioned the correct message keys

For instance, these formats display time in 12h:

dateTimeFormat=dd-MM-yyyy HH:mm a
timeFormat=hh:mm a
localTimeFormat=hh:mm a

Note that messages in your application override messages from all other add-ons.

1 Like

Sorry, this is now showing strange - see below:
image

This is what I have in message.properties

# Date formats
dateFormat=dd/MM/yyyy
dateTimeFormat=dd/MM/yyyy HH:mm a
timeFormat=HH:mm a
offsetTimeFormat=HH:mm Z
offsetDateTimeFormat=dd/MM/yyyy HH:mm Z

Did not notice in my previous post. Use h in lower case:

dateTimeFormat=dd-MM-yyyy hh:mm a
localDateTimeFormat=dd-MM-yyyy hh:mm a
timeFormat=hh:mm a
localTimeFormat=hh:mm a
offsetTimeFormat=hh:mm a Z
offsetDateTimeFormat=dd-MM-yyyy hh:mm a Z

Hi Roman
The above brings am/pm but not the separator as expected.
image

I also tried this:

# Date formats
dateTimeFormat=dd-MMM-yyyy hh:mm a
localDateTimeFormat=dd-MMM-yyyy hh:mm a
timeFormat=hh:mm a
localTimeFormat=hh:mm a
offsetTimeFormat=hh:mm a Z
offsetDateTimeFormat=dd-MMM-yyyy hh:mm a Z

As you have noticed the different format, my application doesn’t display the format given:

image

Hi Mortoza,

For LocalDate and Date datatypes use the following message keys:

dateFormat=dd-MM-yyyy

Upd.
Sorry for the confusion, there are no localDateTimeFormat and localTimeFormat. All available formats you can find here: jmix/jmix-core/core/src/main/resources/io/jmix/core/messages.properties at master · jmix-framework/jmix · GitHub

Also, you can change datatype formatting via “Project properties” from Jmix Studio. Please, refer to Project Properties :: Jmix Documentation

Hi Roman
Thanks for the update. It worked

Date formats

dateFormat=dd-MMM-yyyy
dateTimeFormat=dd-MMM-yyyy hh:mm a
timeFormat=HH:mm a
offsetTimeFormat=HH:mm Z
offsetDateTimeFormat=dd-MMM-yyyy hh:mm Z