JS에서 시간 출력

new 1
실질적으로
Intl.DateTimeFormat()
를 동작한다.

# ko

(new Date()).toLocaleString(['ko'],{dateStyle:'full',timeStyle:'full',hourCycle:'h24'})
=> '2024년 12월 16일 월요일 14시 19분 38초 한국 표준시'

(new Date()).toLocaleString(['ko'],{dateStyle:'medium',timeStyle:'medium',hourCycle:'h24'})
=> '2024. 12. 16. 14:18:06'

(new Date()).toLocaleString(['ko'],{dateStyle:'long',timeStyle:'long',hourCycle:'h24'})
=> '2024년 12월 16일 14시 19분 4초 GMT+9'

(new Date()).toLocaleString(['ko'],{dateStyle:'short',timeStyle:'short',hourCycle:'h24'})
=> '24. 12. 16. 14:19'

# en

(new Date()).toLocaleString(['en'],{dateStyle:'full',timeStyle:'full',hourCycle:'h24'})
=> 'Monday, December 16, 2024 at 14:23:51 Korean Standard Time'

(new Date()).toLocaleString(['en'],{dateStyle:'long',timeStyle:'long',hourCycle:'h24'})
=> 'December 16, 2024 at 14:24:10 GMT+9'

(new Date()).toLocaleString(['en'],{dateStyle:'medium',timeStyle:'medium',hourCycle:'h24'})
=> 'Dec 16, 2024, 14:24:21'

(new Date()).toLocaleString(['en'],{dateStyle:'short',timeStyle:'short',hourCycle:'h24'})
=>'12/16/24, 14:24'
댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
목록형 📅 달력형