One Week between to variable

imhicham
Tera Contributor

how to define just one week without weekend between to variable type Date in catalog 

2 REPLIES 2

Vishal Birajdar
Giga Sage

Hi @imhicham 

 

Below article might help you....!!

 

https://www.servicenow.com/community/developer-articles/validating-the-from-date-and-to-date-and-exc...

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Hayo Lubbers
Kilo Sage

Hi @imhicham,

 

You can use the GlideDateTime, add 7 days (https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/c_GlideDateTimeScop...) and verify if the date is not a Sunday or Saturday (then add 1/2 more days).

 

OR you can use the GlideSchedule, link a proper schedule including holidays and add a number of available time (if you have a schedule from 09:00-17:00 a 'day' extra is adding 8 hours). In this case you can also easily exclude holidays.

More info on the GlideSchedule : https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/c_GlideScheduleScop...