var oDate = new Date(); var iDayOfWeek = oDate.getDay(); var iDay = oDate.getDate(); var iMonth = oDate.getMonth(); var iYear = oDate.getYear(); iYear += (iYear < 2000) ? 1900 : 0; var txtDayOfWeek; var txtMonth; switch (iDayOfWeek) { case 0 : txtDayOfWeek = 'Sun.'; break; case 1 : txtDayOfWeek = 'Mon.'; break; case 2 : txtDayOfWeek = 'Tues.'; break; case 3 : txtDayOfWeek = 'Wed.'; break; case 4 : txtDayOfWeek = 'Thur.'; break; case 5 : txtDayOfWeek = 'Fri.'; break; case 6 : txtDayOfWeek = 'Sat.'; break; } switch (iMonth) { case 0 : txtMonth = 'Jan.'; break; case 1 : txtMonth = 'Feb.'; break; case 2 : txtMonth = 'March'; break; case 3 : txtMonth = 'April'; break; case 4 : txtMonth = 'May'; break; case 5 : txtMonth = 'June'; break; case 6 : txtMonth = 'July'; break; case 7 : txtMonth = 'Aug.'; break; case 8 : txtMonth = 'Sept.'; break; case 9 : txtMonth = 'Oct.'; break; case 10 : txtMonth = 'Nov.'; break; case 11 : txtMonth = 'Dec.'; break; } /*switch (iMonth) { case 0 : txtMonth = '01'; break; case 1 : txtMonth = '02'; break; case 2 : txtMonth = '03'; break; case 3 : txtMonth = '04'; break; case 4 : txtMonth = '05'; break; case 5 : txtMonth = '06'; break; case 6 : txtMonth = '07'; break; case 7 : txtMonth = '08'; break; case 8 : txtMonth = '09'; break; case 9 : txtMonth = '10'; break; case 10 : txtMonth = '11'; break; case 11 : txtMonth = '12'; break; }*/ document.write(txtDayOfWeek + ' ' + txtMonth + ' ' + iDay +','+' ' + iYear); 