Date Functions: Add letter for Quarter in Year - Mendix Forum

# Date Functions: Add letter for Quarter in Year

6

In Chapter 1 of Parse and Format Date Function Calls there is a list of letters which correspond to a certain date/time value. Missing from this list is a letter for 'quarter in year' with values one through four. Because this letter is missing, I need to create three lists using 'L' for 'month in year' instead, and then combine these into a singular list. Since this needs to be done four times a year it is hurting the performance of my app.

In X-Paths you have the quarter-from-dateTime function. An equivalent microflow option would be great.

Yeah, you are right. 😅 You should divide by 3 and use floor instead of round. Updated my comment.

Created

Hi Johan,

Thank you for the suggestion, but this is unfortunately not bullet-proof. Take October for example:

formatDateTime(\$DateInOctober,'M') = 10

((10-1):4) + 1 = 3.25

This rounds down to Q3, but October belongs in Q4.

However, dividing by three and using the floor() function does work. Thanks! :)

Created

Although I like the idea, you can just calculate it right?

floor((parseInteger(formatDateTime(\$Variable,'M'))-1) : 3) + 1

Would this help?

Created