Для нормальной работы с датами. Пример использования:
var dt = new DateTime(new Date());
dt.ToDateString(); // ~ "05.03.2008"
Сам класс:
/**
*
* @param {Date} date
*/
function DateTime(date){
this.dt = date;
this.Day = date.getDay();
this.Month = date.getMonth();
this.Year = date.getFullYear();
}
DateTime.prototype = {
/**
* ~ 01.09.2007
*/
ToDateString: function(){
return this.Format(this.Day + 1) + '.' + this.Format(this.Month + 1) + '.' + this.Year;
},
/**
* 1 -> 01
*/
Format: function(number){
return number < 10 ? '0' + number : number;
}
}