โ02-10-2022 01:08 PM
How to get which quarter from the date format 2022-01-31
Is there any formula to get, quarters ( Q1, Q2, Q3,Q4) from the date
โ02-14-2022 07:19 PM
โ02-15-2022 07:32 AM
Looks like the quarter is not a Ruby default method, so the way we can do this is use one of the code connectors like JavaScript. Here is an example how it will look like. Given the input_date is the date you want to calculate quarter for (or you can just type today in formula. We return quarter as output.
1. add JavaScript connector
2. Create input called input_date with type date
3. create output quarter of type integer
4. add this code snippet:
exports.main = ({input_date}) => {
var today = new Date(input_date)
var quarter = Math.floor((today.getMonth() + 3) / 3);
return { quarter };
}