0

How to know if Locale/system is using 12 or 24 hours format in JavaScript without using any 3rd Party Libraries ?

GG.
  • 19,404
  • 12
  • 77
  • 125
avi
  • 202
  • 5
  • 14

2 Answers2

-1

You can use toLocaleTimeString method.

let date = new Date();
date.toLocateTimeString()
Amit
  • 3,010
  • 2
  • 25
  • 31
-1

You can use Date() constructor.

Check JSFiddle

Andy
  • 521
  • 3
  • 6
  • 22