code: function(date) {
          var num = 0,
              d = Ext.Date.clone(date),
              m = date.getMonth(),
              i;
  
          for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
              num += utilDate.getDaysInMonth(d);
          }
          return num + date.getDate() - 1;
      }
docs: Get the numeric day number of the year, adjusted for leap year.
  @param {Date} date The date
  @return {Number} 0 to 364 (365 in leap years).