Add 2 hours to Start date and End date

Lucky1
Tera Guru

Hi all,

 

From a change request, I am printing Start date and End date in scripts background.

I want to add 2 hours to the Start date and End date. Using below code I can add it to either start date or End date.

But how can I add it to both Start Date and End date at once using one GlideDateTime method?

var sd = current.start_time.getDisplayValue(); //getting start date value of CR

var ed = current.end_time.getDisplayValue(); //getting end date value of CR

 

var gdt = new GlideDateTime(sd);

var hours = 60*60*2;

gdt.addSeconds(hours);

 

 

So, please help

 

 

Regards,

Lucky

5 REPLIES 5

@Lucky1 

Hope you are doing good.

Did my reply answer your question?

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