0

What is the idiomatic way to extract the local clock time from a Date Object. I can do string split like this but it does not look idiomatic to me

> date = new Date()
2022-06-13T04:37:50.074Z
> date.toString()
'Sun Jun 12 2022 21:37:50 GMT-0700 (Pacific Daylight Time)'
> date.toString().split('T')[0].split(' ')[4]
'21:37:50'
Huy Le
  • 139
  • 1
  • 6

0 Answers0