FieldGroup for DateTime Attribute

Hello,
So I have an entity that the attribute KnowledgeDate as DateTime.
On my screen (generated with "create standard screens), this attribute shows up within a fieldgroup. The components are a DateField and a TimeField.
The problem is that since I don’t have control of the TimeField, I can use the “ShowSeconds” option.
So I thought that maybe I should use two custom fields (DateField and TimeField) and link them back to the fieldgroup, but somehow for the custom field it seems that I can only return one field at a time.

Anyway, I’m trying to display the date as MM/dd/yyyy hh:mm:ss
Thanks.

Hello,
The format of the DateTime field may be changed to “MM/dd/yyyy hh:mm:ss” by setting its resolution to SEC.
See https://doc.cuba-platform.com/manual-6.2/gui_DateField.html#gui_DateField_resolution.
This may be done by calling the ‘setResoluton()’ method.


    @Named("fieldGroup.dateTimeField")
    private DateField dateTimeField;
.....
   @Override
   public void init(Map<String, Object> params) {
            dateTimeField.setResolution(DateField.Resolution.SEC);
            super.init(params);
}

Or declaratively in the XML screen descriptor.

<fieldGroup id="fieldGroup"
                    datasource="someEntityDs">
            <column width="200px">
                <field id="dateTimeField" resolution="SEC"></field>
                <field id="dateField"></field>
....

After that, the corresponding field should look as in the attachment.
Regards.

DateTimeField

Thanks. It worked great.