Check date in past - using getNumericValue()


var grRITM= new GlideRecord('sc_req_item');
if (grRITM.get('number', 'RITM0016049')){
   //gs.print(grRITM.due_date.getNumericValue());
  //gs.print(grRITM.due_date.getGlideObject());


  var dateEntered=new GlideDateTime();
  dateEntered.setDisplayValue(grRITM.due_date);

  gs.print(dateEntered.getNumericValue());

var dateNow=new GlideDateTime();
  dateNow.setDisplayValue(gs.nowDateTime());

  gs.print(dateNow.getNumericValue());
  if (dateEntered<dateNow){
    gs.print('past');
  }else{
        gs.print('not-past');
  }
}

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue