<html>
<head>
<title>BLUEB</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function formatDate(date) {
var mymonth = date.getMonth()+1;
var myweekday = date.getDate();
return (mymonth + "/" + myweekday);
}
function printWeek() {
var now = new Date();
var nowDayOfWeek = now.getDay();
var nowDay = now.getDate();
var nowMonth = now.getMonth();
var nowYear = now.getYear();
nowYear += (nowYear < 2000) ? 1900 : 0;
var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
document.write("이번주는 : " + formatDate(weekStartDate) + " - " + formatDate(weekEndDate));
}
-->
</script>
</HEAD>
<BODY>
<b>
<script>
printWeek();
</script>
</BODY>
</HTML>
'JAVASCRIPT > 날짜관련기법' 카테고리의 다른 글
[Java Script] 오늘날짜, 특정 날짜의 요일 구하기 예제 (년도, 월, 일, 요일) (0) | 2016.01.20 |
---|---|
자바스크립트 날짜 계산 - 오늘, 어제, 내일, 전일, 전전일 등 (0) | 2016.01.20 |