재우니의 블로그


datetime 날짜 json 값을 년-월-일 시:분:초 형태로 표기하고자 한다면...



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
function dateTimeFormat(dateTimeValue)
{
var dt = new Date(parseInt(dateTimeValue.replace(/(^.*\()|([+-].*$)/g, '')));
var dateTimeFormat = dt.getFullYear() + "-" + (dt.getMonth() + 1) + '-' + dt.getDate() + ' ' + dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
return dateTimeFormat;
}

var dates = '/Date(1448583916000)/';
alert(dateTimeFormat(dates));

</script>
</head>
<body>
</body>
</html>


결과는 "2015-11-27 9:25:16" 입니다.