Date in Selectbox

by Joe Saad

HTML

<select id="date">
</select>

JavaScript

var d = new Date();
var t_day = d.getDate();
var t_month;
if (parseInt(d.getMonth()+1) < 10) {
   t_month = '0'+parseInt(d.getMonth()+1);
}
else {
   t_month = parseInt(d.getMonth()+1);    
}

for (i=0; i<=6; i++ ) {
    $('#date')
        .append('<option>'+t_month+'/'+parseInt(t_day-i)+'/'+d.getFullYear()+'</option>');
}