자바스크립트타임존다루기with typeOrm

코드깎는 노인·2021년 7월 20일
0
post-thumbnail
post-custom-banner
  var timezoneOffset = new Date().getTimezoneOffset() * 60000; // korea offset 540min*60sec*1000
  // '2020-01-01'
  var nonTimeZone = new Date(new Date(`2021-03-03 00:00:00`).getTime());
  var afterTime = new Date(new Date(`2021-03-03 00:00:00`).getTime() - timezoneOffset);
  var beforeTime = new Date(new Date(`2021-03-03 23:59:59`).getTime() - timezoneOffset);
  console.log('offset0StringTime ', nonTimeZone.toISOString());
  console.log('offset9StringTime ', afterTime.toISOString());
  console.log('offset0DateObject ', nonTimeZone);
  console.log('offset0DateObjectHour ', nonTimeZone.getHours());
  console.log('offset9DateObject ', afterTime);
  console.log('offset9DateObjectHour ', afterTime.getHours());

pic1(node.js_kor)

pic2(node.js_US)

pic3(chrome_kor)
profile
내가 볼려고 만든 블로그
post-custom-banner

0개의 댓글