Days between two dates

0
Hello Everyone I want to retrieve the number of days between two dates. Can anyone help describe the microflow for this. I would like to know how to use below function calls. https://docs.mendix.com/refguide/between-date-function-calls
asked
3 answers
4

You can use the daysBetween function to set a variable or set an attribute in an entity.

For example, if you  had an entity called $Entity with attributes Date1 and Date2, and you wanted to create a variable based on that number of days between the two attributes, you’d use the following in the Create Variable action.

daysBetween($Entity/Date1, $Entity/Date2)

This returns a decimal, so you need to use either round, floor, or ceil to turn this into an integer.

Hope this helps.

answered
3

I am not sure what do you mean with “the microflow for this”, but you can create a local varaible as eg. integer and use the function in the create variable action:

daysBetween($YourDate1, $YourtDate2)

Both values needs to be of type datetime.

 

answered
0

Thanks Robert and Gerrit.

I am getting an error "An action with side effects is not allowed in a microflow because it is used as the source of an attribute”. Please help me figure out whats wrong.

answered