코드:
결과보기 »
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>JavaScript Date Method</title> </head> <body> <h1>getDay() 메소드</h1> <script> var date = new Date(); var day; switch (date.getDay()) { // 현재 요일을 반환함. case 0: day = "일"; break; case 1: day = "월"; break; case 2: day = "화"; break; case 3: day = "수"; break; case 4: day = "목"; break; case 5: day = "금"; break; case 6: day = "토"; break; } document.write("오늘은 " + day + "요일입니다."); </script> </body> </html>