var weekStr = '일월화수목금토';
dayGap = 2000;
now = new Date();
newDay = new Date();
newDay.setDate(now.getDate() + dayGap);
newYear = newDay.getFullYear();
newMon = newDay.getMonth() +1;
newDate = newDay.getDate();
newWeekDay = weekStr.substr(newDay.getDay(),1);
document.write(now + ' + ' + dayGap + '일 = ');
document.write(newWeekDay + '요일 ' + newMon + '월 ' + newDate + '일 ' + newYear + '년');
document.write('<br>' + newDay);
반응형
'Programming > JavaScript' 카테고리의 다른 글
[JavaScript] 3-5_evalFunc.js (0) | 2016.12.07 |
---|---|
[JavaScript] 3-4_TypeCastFunc.js (0) | 2016.12.07 |
[JavaScript] 3-3_escapeFunc.js (0) | 2016.12.07 |
[JavaScript] 3-1_PrintTime.js (0) | 2016.12.07 |
[JavaScript] 3-0_Variables and Functions (0) | 2016.12.07 |