GlideSystem - minutesAgo(Number minutes)

Returns a date and time for a specified number of minutes ago.

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

// Check to see if the user has failed to login too many times
// when the limit is reached, lock the user out of the system
  //Check failed logins in the last 15 minutes
  var gr = new GlideRecord('sysevent');
  gr.addQuery('name', 'login.failed');
  gr.addQuery('parm1', event.parm1.toString());
  gr.addQuery('sys_created_on','>=', gs.minutesAgo(15));
  var rowCount = gr.getRowCount();
  if(rowCount >= 5){
      var gr = new GlideRecord("sys_user");
      gr.addQuery("user_name", event.parm1.toString());
      if ( {
           gr.locked_out = true;
           gs.log("User " + event.parm1 + " locked out due to too many invalid login attempts");