I want add one day plus in existing probation end date

rmaroti
Tera Contributor

Hi ALL,

 

I have requirement to add one day plus in existing probation end date:

Script template code:

var prbEndDate = target.subject_person_hr_profile.probation_end_date;
    var date = new GlideDate(prbEndDate);
    date.addDays(1);
    var newDate = date.getByFormat("dd.MM.yyyy");
    return newDate;
 
 
as per above code one day plus is not working. for example if my probation end date is 19/06/2024 then it will written 20/06/2024 that is expected output.
1 REPLY 1

Voona Rohila
Kilo Patron
Kilo Patron

Hi @rmaroti 

Try this

var prbEndDate = target.subject_person_hr_profile.probation_end_date;
    var date = new GlideDateTime(prbEndDate);
    date.addDays(1);
    return date.getDate().getByFormat("dd.MM.yyyy");

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP