Is there anyway to find which quarter(fiscal period) of a given date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 10:31 AM
Is there any OOB functionality or scripts to find the quarter(fiscal period) of a given date?
For example, if I pass current date(08/23/2017), I should see the quarter number like Q3.2017 as a result in return.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 10:56 AM
Hello,
I have come up with a simple javascript function that returns the fiscal date in a small fiddle below.
Cheers,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 10:57 AM
I'd probably go this route:
var gDate = new GlideDate();
gDate.setValue('2017-08-23');
var quarter = 'Q' + (Math.floor((gDate.getMonth() - 1) / 3) + 1) + '.' + gDate.getYear();
Feel free to tweak it to customize the exact appearance, of course.
Hope this helps,
--Dennis R
Edit: Ninja'd by Patrick. I think we used the same methodology.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 11:05 AM
Hi
here is the below server side query.
var today = new Date();
//gs.print(today);
var month = today.getMonth();
//gs.print(month);
var quarter;
if (month < 4)
quarter = 1;
else if (month < 7)
quarter = 2;
else if (month < 10)
quarter = 3;
else if (month < 13)
quarter = 4;
gs.print(quarter);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 03:11 AM
This might help you
new global.FinancialsForPPM().getFiscalPeriod('2019-03-03 12:00:00');