0

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

GG.
  • 21,083
  • 14
  • 84
  • 130
avi
  • 212
  • 1
  • 5
  • 15

2 Answers2

-1

You can use toLocaleTimeString method.

let date = new Date();
date.toLocateTimeString()
Amit
  • 3,662
  • 2
  • 26
  • 34
-1

You can use Date() constructor.

Check JSFiddle

Andy
  • 521
  • 3
  • 6
  • 22