How could I get the date of next monday(any other day) in script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2015 04:19 AM
Hello All,
I have a search about this question on community's threads but not got my answer. So could you please help to get the date of next monday(or any other day) if a date is provided.
Suppose I have a date 2015-12-10 and I have a day in Integer(1),
as per SNow: 1 for Monday and 7 for Sunday.
Now a function return me the date(2015-12-14).
Or if i have date 2015-12-14 then return me 2015-12-14.
Thanks-
Macarius Anna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2015 06:07 AM
var todayDateTime = new GlideDateTime(nowDateTime());
var integerValForToday = todayDateTime.getDayOfWeekLocalTime();
gs.print(integerValForToday);
var adderForMonday = 15- integerValForToday; // Change 15 to 8 if you want to find the coming week monday, 15 will return next week monday
todayDateTime.addDaysLocalTime(adderForMonday);
gs.print(todayDateTime.getLocalDate()); // Store the value inside the gs.print to any varaible. I have run this script as background to check if returns correct value. It worked for me
Hi Anna,
I have run the above code a scripts background and it worked for me.
You can convert it to script include as per your requirement.
For reference to GlideDate APIs check below link
For reference to GlideDateTime APIs check below link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2015 02:35 AM
Thanks Deepak,
You give me a direction to get next day from a date. This is really very helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017 07:03 AM
This helped today!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2021 08:31 AM
It Really helps me alot.
Thanks