Scoped GlideSystem - daysAgo(Number days)

Returns the date and time for a specified number of days ago.

Table 1. Parameters
Name Type Description
days Number Integer number of days
Table 2. Returns
Type Description
String GMT in the format yyyy-mm-dd hh:mm:ss

function contractNoticeDue() {
    var gr = new GlideRecord("contract");
    gr.addQuery("u_contract_status", "Active");
    gr.query();
    while (gr.next()) {
        if ((gr.u_termination_date <= gs.daysAgo(-90)) && (gr.u_contract_duration == "Long")) {
            gr.u_contract_status = "In review";
        } 
        else if ((gr.u_termination_date <= gs.daysAgo(-50)) && (gr.u_contract_duration == "Medium")) {
            gr.u_contract_status = "In review";
        } 
        else if ((gr.u_termination_date <= gs.daysAgo(-10)) && (gr.u_contract_duration == "Short")) {
            gr.u_contract_status = "In review";
        }
    }
    gr.update();
}