- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 10:22 PM
1.Quarter number
2.Current number
Display Quarter number based on date
Ex: Jan to march Between related dates Display Quarter -1
April to June Between related dates Display Quarter -3 etc.
Ex:
now Current date: 2017-01-20 week: Quarter-1;
now Current date:2017-05-14 week: Quarter-2
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 12:22 AM
remove current.update()
var check= current.u_another_open;
var test = new GlideDateTime(check);
var mn = test.getMonth();
var quar = Math.ceil(mn/3);
gs.log('hellosssssss'+quar);
current.u_dateee=quar;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 12:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 10:36 PM
Hi,
Try this code:
- var gDate = new GlideDate();
- gDate.setValue('2017-08-23');
- var quarter = 'Quarter-' + (Math.floor((gDate.getMonth() - 1) / 3) + 1) ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 11:44 PM
Hi Gowrisankar,
Script is showing error,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 10:43 PM
var gdt = new GlideDateTime();
var month = gdt.getMonth();
gs.print(month);
if((month==1) ||(month==2) ||(month==3) ||(month==4)){
gs.print("Quarter::1");
}
else if((month==5) ||(month==6) ||(month==7) ||(month==8)){
gs.print("Quarter::2");
}
else{
gs.print("Quarter::3");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 11:24 PM
Hi Divya,
If your fiscal year aligns with the calendar year, you can simplify that down to:
var gdt = new GlideDateTime();
gs.print("Quarter::" + parseInt(gdt.getMonthLocalTime()/3));
Thanks,
-Brian
Edit: I missed using Math.ceil() to round up, thanks to others who pointed that out.