Time part of DateTime in Mendix

4
Hi, I'm using Mendix 2.4.5 and I can't find how to present and edit the time part of a DateTime field. On a form it uses the DatePicker, but there is no time part in there. Can anyone explain how to use the time part? Thanks, Bart using Enzo's account
asked
4 answers
5

Hi,

Thanks for the answer. I implemented the following:

1) Per DateTime field a String field of length 8 to contain hh:mm:ss

2) A regular expression to format the string: (([0-1][0-9])|([2][0-3])):[0-5][0-9]:[0-5][0-9]

3) The String field besides the DatePicker field

4) Microflow to set the String field on change of the DatePicker field, as suggested: formatDateTime($Object/DateTimeField,'HH:mm:ss')

5) Microflow to set the DatePicker field on change of the String field parseDateTime(formatDateTime($Object/DateTimeField,'dd-MM-yyyy')+' '+$Object/StringField,'dd-MM-yyyy HH:mm:ss')

6) When setting the DateTime from other places also set the String field.

This is a lot of work for what I think should be in the tool automatically.

I would like to know if Mendix intends to implement a DateTime field?

Can I alter the DatePicker dialog and field somewhere to include time?

Kind regards,

Bart

answered
4

An option is to use a string attribute. You can set this string value by calling a microflow triggered on change of the DatePicker. By setting the string value, you can use a microflow expression: formatDateTime($object/Date,'HH:mm:ss') and set it to string.

Further, you can make the input field time editable, which enables users to edit the time.

answered
2

Hi Bart,

In our upcoming release, Mendix 2.5, we implemented options to render the time part of a DateTime attribute in dataview fields and grid columns. We will also provide a timepicker via our AppStore.

answered
1

Hi Johan,

Thanks for the answer. This sounds good. As soon as the beta is available I would like to have a look at it.

Why also via the AppStore? Is there a basic widget included in 2.5 and some advanced features via the AppStore?

Kind regards,

Bart

answered