How to check if the given date falls in current week and current month

Pratiksha Lang1
Kilo Sage

How to check if the given date falls in current week and current month

Using filter in encoded query as date on today or date on this month works as per the user time zone. But I want this be achieved via script and in IST time zone, I want to check if the date falls in current week or current month.

 

 

8 REPLIES 8

@Ankur Bawiskar  I checked that link and addDays doesn't work in scoped application. I tried running that script in background. 

@Pratiksha Lang1 

for scoped app use addDaysUTC()

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar  Yes I have used addDaysLocalTime and it gives me the start of the week and end of the week. but how to know if the given date falls in current month or not

@Pratiksha Lang1 

similar logic

get start date of the month and last date of the month, then check if your date falls in between those

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader