How to create a integer variable with the current quarter?

Hi guys, I tried to use the following Constraint: quarter-from-dateTime('[%CurrentDateTime%]') to create a integer varible but there is a microflow error when i tried it. Is there any way to create a variable with the current quarter? Thanks for the help.  
1 answers

quarter-from-datetime is for XPaths, so won’t work here.

Assuming you have a localised DateTime called $Date, you can get the current quarter when creating a variable using…

ceil(parseInteger(formatDateTime($Date, 'M')) div 3)

If your DateTime isn’t localised, use formatDateTimeUTC.

Hope this helps​​​​​​​