Error message in microflow expression: The first argument of function DateTime must be a literal integer

I try to instantiate a DateTime variable with the DateTime() function. It expects 6 integers as parameters. But when I parse a integer variable I've created earlier in the flow I get an error. The following expression: dateTime($overlijdenJaar, $overlijdenMaand, $overlijdenDag, 0, 0, 0) Gives this error: The first/second/third argument of function 'DateTime' must be a literal integer. Note: I get only errors for the first three variables. That are microflow variables of type Integer/Long
2 answers

The function dateTime is there to create a date and time literal and can indeed only be used with literal integers as parameters. For example, dateTime(2010,4,9,10,2,0) for the time that I started writing this reply.

What you want to do can be achieved by constructing a textual date and then parsing it as follows:

parseDateTime($year + '-' + $month + '-' + $day, 'yyyy-MM-dd')


Dear Mendix,

Is the dateTime function obsolete, in this way? When it does not accept the integer/Long type of Mendix, it is only usable with a hard coded value. That is not recommend to do in any case.

Would be nice it this 'bug' is documented in the official documentation including the workaround. (That would save many programmers an annoying 20 minutes, to discover that the function is useless)

Or even better; change the input type of the function, so it will accept a data type that is used by the Mendix platform!

Cheers, Andries