+ Start a Discussion
chrismclarenchrismclaren 

Toady - 30

I am trying to check users who have logged in over the last 30 days.  Not sure how to do this.  The field LastLoginDate returns a date in the format Wed Jan 17 19:01:53 UTC+0100 2007.  So what I need is to get the current date -30 days and then somehow return all users with the LastLoginDate greater than this returned value.
 
Any suggestions? 
DevAngelDevAngel
you  could do this:

Code:
Date.prototype.add = function (sInterval, iNum){
  var dTemp = this;
  if (!sInterval || iNum == 0) return dTemp;
  switch (sInterval.toLowerCase()){
    case "ms":
      dTemp.setMilliseconds(dTemp.getMilliseconds() + iNum);
      break;
    case "s":
      dTemp.setSeconds(dTemp.getSeconds() + iNum);
      break;
    case "mi":
      dTemp.setMinutes(dTemp.getMinutes() + iNum);
      break;
    case "h":
      dTemp.setHours(dTemp.getHours() + iNum);
      break;
    case "d":
      dTemp.setDate(dTemp.getDate() + iNum);
      break;
    case "mo":
      dTemp.setMonth(dTemp.getMonth() + iNum);
      break;
    case "y":
      dTemp.setFullYear(dTemp.getFullYear() + iNum);
      break;
  }
  return dTemp;
}

//sample usage
var d = new Date();
var d2 = d.add("d", 3); //+3days
var d3 = d.add("h", -3); //-3hours
alert(d2);
alert(d3);

 
 
chrismclarenchrismclaren

What are the variables sInterval, iNum that you are passing to this function?