- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 03:48 AM
I have 2 datetime fields ( i.e. start date and end date) on incident form , I want to calculate if end date -start date in > 90 and if yes, I want to perform some action. I do not want to use server side script. How can I achieve this ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 03:54 AM
Hi Uma,
Kindly refer to this link, which takes care of date calculations using client script.
Mark the comment as a correct answer and also helpful once worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 03:54 AM
Hi Uma,
Kindly refer to this link, which takes care of date calculations using client script.
Mark the comment as a correct answer and also helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 04:15 AM
Use below code
var my_start_gdt = new GlideDateTime();
var my_end_gdt = new GlideDateTime();
my_end_gdt.setValue('2019-09-02');
var days_between = parseInt(gs.dateDiff(my_start_gdt.getDate(),my_end_gdt.getDate()));
//days between two days
var day_of_the_week = my_start_gdt.getDayOfWeekUTC();
//day of the week
var number_of_weekends = parseInt((days_between+day_of_the_week)/7);
//calculate weekend
var days_between_without_weekends = days_between - (number_of_weekends*2);
gs.log(days_between_without_weekends)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 03:48 AM
I know this question is already solved but the link below details a whole bunch of useful glidedatetime client script functions all running off the same script include: