Schedule Object working ? (new GlideSchedule) .

Viraj7
Tera Contributor

Hello All,

As we know if i want to find dateTime after 2 days from now using some schedule, we will use 

var Sc = new GlideSchedule('sys_id');

Sc.add(currentDateTime, duration);

 

Is there any way i can get dateTime 2 days ago using same schedule???

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

yes it's possible

check this

Add Business Days

Regards
Ankur

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

Hello Ankur, You might miss interpreted the question. I don,t want to add the days to schedule, I want to substract the days from a given schedule. 

 

For eg. Duration is 8 hours and end time is current date time. I want to find the start time here.

 

Hi,

for subtraction check this

https://community.servicenow.com/community?id=community_article&sys_id=c4ccae25dbd0dbc01dcaf3231f961...

Regards
Ankur

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

John Dewhurst
Kilo Guru

Let me check I understand the requirement...

So given a target date and time to deliver you want to extrapolate back and find the latest start datetime to make that delivery date?

It doesn't seem possible using GlideSchedule but it seems like a valid use case, might be worth submitting an idea?