Date.prototype.date = function(format)
{
    for (var i = 0, c = '', returner = '', formats = new Object(); i < format.length; i++)
    {
        c = format.charAt(i);
        if (c == '\\' && i + 1 < format.length) returner += format.charAt(++i);
        else if (typeof formats[c] != 'undefined') returner += formats[c];
        else
        {
            switch (c)
            {
                case 'd':
                    var day = this.getDate();
                    formats[c] = (day < 10 ? '0' : '') + day;
                    break;
                case 'H':
                    var hour = this.getHours();
                    formats[c] = (hour < 10 ? '0' : '') + hour;
                    break;
                case 'i':
                    var minute = this.getMinutes();
                    formats[c] = (minute < 10 ? '0' : '') + minute;
                    break;
                case 'm':
                    var month = this.getMonth() + 1;
                    formats[c] = (month < 10 ? '0' : '') + month;
                    break;
                case 'Y':
                    formats[c] = this.getFullYear();
                    break;
                default:
                    formats[c] = c;
                    break;
            }
            returner += formats[c];
        }
    }
   
    return returner;
}
