JavaScript
toDateString 예문
아이티제어1998
2022. 5. 6. 20:13
var d = new Date(msg.payload);
msg.payload = d.toISOString();
return msg;
// convert a GMT date string into a Date in my local timezone
> new Date("2019-05-04").toDateString()
'Fri May 03 2019' <--- since I am behind the International Date line
// convert a local date string into a local Date object in my tz
> new Date("2019-05-04".split("-")).toDateString()
'Sat May 04 2019'
var now = new Date().toLocaleString("en-GB");
return {payload: now};
var now = new Date().toLocaleString("ko-KR");
return {payload: now};
형식을 사용하는 m/d/yyyy것이 모호 4/5/2019합니다. 미국에서는 "2019년 4월 5일"이지만 유럽에서는 "2019년 5월 4일"로 해석될 수 있습니다...