Add days to date

JG16
Tera Contributor

hi,

 

In Business Rule How can i add years/days to date .

I have tried like below 

var createdDate = new GlideDateTime(attestationGR.sys_created_on);

var duedate = createdDate.addDays(365); //default 1 year

but it throws the below error. Please help me. I cannot use addLocaldays. how to  go with adddaysUTC  function to align time or another way ?

ERROR : Function addDays is not allowed in scope sn_hr_core. User either addDaysUTC() or addDaysLocalTime() instead

 

Thanks 

JG

 

 

 

 

 

7 REPLIES 7

Priti Golam1
Tera Expert

Hello,

Kindly go through below link it might be helpful

https://community.servicenow.com/community?id=community_question&sys_id=a2f04ba5db98dbc01dcaf3231f96...

 

Mark correct or helpful if it helps you

Thanks,

Priti

Thank you so much. It helped me. 

 

Thank you all for your quick replies.

 

JG

can you just mark helpful or correct

Thanks

Priti