Format date

0
Can someone instruct me how to do the data calculation in Mendix. Specifically I have 2 attributes of type string. When the user enters the date for the first attribute (applicationDate) I should get the 15th day of the following month (example: user entered - 28-03-2021, I should get back 15-04-2021), for the second attribute (firstInstallmentDueDate) it should always return today. Attributes are of type string because that is how it must be in JSON.    EDIT:  Can someone instruct me how to do the data calculation in Mendix. Attribute applicationDate should be calculated in relation to current time (if for example currentTime is '2021-06-06', applicationDate should be '2021-07-15', in fact, applicationDate should always be the 15th day of the following month)    
asked
2 answers
4

Hi Peter,

Kindly Have look, Hope it will be helpful for you.

answered
2

Hi Peter,

I would recommend you to go through the Mendix documentation for date time Fucntions :

https://docs.mendix.com/refguide/parse-and-format-date-function-calls

 

Secondly if i am doing this task I would prefer having  two atributes one for User Interaction which is a Date time Attribute and Secondly String attribute for passing to JSON. 
When ever the user is changing the value put a onchange flow or do a chnage object in the save microflow and do the Date time cacluclation and set it to string attribute using date Time Functionions like FormatDateTime( Date→ String). 

For your second case you can follow the same two attribute FirstInstallmentDueDate- DateTime Attribute and FirstInstallmentDueDateSTR – String.  So that you can keep the Default value of CurrentDate time for the DateTime Attribute which suffice for your second use case. 

Accept my answer if it helps your use case. ATB!!

answered