Get Specific Day of the Week
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 08:09 AM
I have table with a date field. Sometimes that date could fall on a Tuesday, Wednesday, Thursday, Friday, etc.
I want to find the Monday of the week that date falls in. Is there a specfic function to find a specific day of a certain week? I know I can find out what week it is using getWeekofYearUTC(), but is there a way find the Monday of Week 24?
or is my best option to write something like this:
var gdt = new GlideDateTime('2017-10-17 12:00:00');
var dy = gdt.getDayOfWeek();
if (dy == 2) {
gdt.addDays(-1)
}
if (dy == 3) {
gdt.addDays(-2)
}
...
gs.print(gdt);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 08:13 AM
Check the below thread
How could I get the date of next monday(any other day) in script include?
Harish