박지환

Test time set

......@@ -32,15 +32,26 @@ app.use(static(__dirname));
// To get today date by using Date
function getTodayDate() {
var today = new Date();
var tempDate = new Date();
const utc = tempDate.getTime() + tempDate.getTimezoneOffset() * 60 * 1000;
const KR_TIME_DIFF = 9 * 60 * 60 * 1000;
const today = new Date(utc + KR_TIME_DIFF);
console.log(today);
var year = today.getFullYear();
var month = ("0" + (today.getMonth() + 1)).slice(-2);
var day = ("0" + today.getDate()).slice(-2);
var dateString = year + "-" + month + "-" + day;
//return "2022-12-25"; // 테스트용 날짜를 입력하세요. *** 테스트가 끝나면 주석처리하고 커밋해주세요. *** ex) 2022-09-12, 2022-09-15, 2022-10-04
// return "2022-12-25"; // 테스트용 날짜를 입력하세요. *** 테스트가 끝나면 주석처리하고 커밋해주세요. *** ex) 2022-09-12, 2022-09-15, 2022-10-04
return dateString;
}
function test() {
var tempDate = new Date(); // Locale time
const utc = tempDate.getTime() + tempDate.getTimezoneOffset() * 60 * 1000; // Calculate UTC time
const KR_TIME_DIFF = 9 * 60 * 60 * 1000; // UTC to KST (UTC + 9 hours)
return utc + KR_TIME_DIFF;
}
// To get modified date from locdate
function getModifiedDate(locdate) {
return (
......@@ -202,6 +213,11 @@ app.get("/app", function (req, res) {
);
});
app.get("/test", function (req, res) {
init();
res.send(Date() + "<br>" + Date(test()) + "<br>" + test());
});
init();
const port = 8080;
......