Hi Perumal,

 

Where are trying to do this, is it for the service portal, your script seems to be of the widget?

 

Anyways, if you are using GlideSchedule

 

"isInSchedule" method would help you

 

var glide = new GlideRecord('cmn_schedule');
glide.addQuery('type', 'blackout');
glide.query();
if (glide.next()) {
var sched = new GlideSchedule(glide.sys_id);
var date = new GlideDateTime();
date.setDisplayValue("2007-09-18 12:00:00");
if (sched.isInSchedule(date))
gs.info("Is in the schedule");
else
gs.info("Is NOT in the schedule");
}

 

Source: https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/c_GlideScheduleScopedAPI

 

Important: check your schedule if it is set repeating

Screenshot_20231012_084825.jpg