Detect with javascript if user's machine is using 12 hour clock (am/pm) or 24 clock (military time)

Is it possible to detect if user’s machine is using 12 hour clock (am/pm) or 24 hour clock (military time)?

One way would be to check users locales, but then it is just massive list of locale comparison and someone from U.S who wants 12 hour clock can send me just en locale, not US_en and I have no way of knowing her preferences. At the same time someone from U.S might be set her machine to use 12 hour time format and doesn’t want 12 hour clock.

EDIT:

date.toLocaleTimeString();

Would work it theory, as user Mouser suggested below, but unfortunately it’s bugged on WebKit browsers (tested on Chrome and new Opera on Windows) and for some reason always returns am/pm time.

Example: http://jsfiddle.net/sjuaL3p4/

So I guess I have to rephrase my question if anyone has an idea how to accomplish it on webkit browsers also.

20 thoughts on “Detect with javascript if user's machine is using 12 hour clock (am/pm) or 24 clock (military time)”

  1. Good day I am so thrilled I found your site, I really found you by error,
    while I was browsing on Google for something else, Anyways I am here now and would just like
    to say cheers for a fantastic post and a all round exciting blog (I also love
    the theme/design), I don’t have time to browse it all at the moment but I have saved it and also added your RSS feeds, so when I have
    time I will be back to read a lot more,
    Please do keep up the excellent work. https://herreramedical.org/hydroxychloroquine

    Reply

Leave a Comment