<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>11_moment</title>
<style>
#time{
margin: 70px;
text-align: center;
font-size: 30px;
font-weight: bold;
}
</style>
<!-- jquery import -->
<script src="jquery-3.6.4.min.js"></script>
<script src="moment-with-locales.min.js"></script>
</head>
<body>
<h3>moment.js 오픈소스</h3>
<h1 id="time"></h1>
<script>
/*
자바스크립트 기반 오픈소스 인기 순위 https://stats.js.org/
moment.js
-자바스크립트의 내장객체 date의 복잡성을 단순, 다양하게 사용하기 위한 자바스크립트기반 오픈소스
-https://momentjs.com/
-사용하기 위해서는 jquery부터 import 필수
*/
/*
//1.자바스크립트
//문제. 2023년 3월 30일 13시 12분 45초 출력하기 id=#time
let now= new Date();
let $now_date= now.getFullYear()+"년"+(now.getMonth()+1) +"월"+now.getDate()+"일"+now.getHours()+"시"+now.getMinutes()+"분"+now.getSeconds()+"초";
$("#time").append($now_date);
$("time").text($now_date);
////////////////////////////////////////////////
let year=now.getFullYear();
let month= now.getMonth()+1;
let date= now.getDate();
let hour = now.getHours();
let min= now.getMinutes();
let sec= now.getSeconds();
let fulldate="";
fulldate +=year+"년"+month+"월"+date+"일";
fulldate +=hour+"시"+min+"분"+sec+"초";
$("#time").text(fulldate);
*/
/////////////////////////////////////////////
// 2.moment.js
let now= moment();
// alert(now.year());
// alert(now.month());
// alert(now.date());
// alert(now.day());
moment.locale("ko");//한글 날짜 형식으로 지정
var fulldate=now.format("YYYY년MM월DD일HH시MM분SS초");
$("#time").text(fulldate);
</script>
</body>
</html>