I have some opening hour information on my website/database in the hh:mm AM/PM format and would love to convert it to 24-hour hh:mm if the users browser language settings prefers that format instead of the AM/PM format.

I heard this is possible with Javascript's **.toLocaleTimeString()**.
Who could help me with a function?

given e.g.

```
var time = '11:30am to 3pm, 5 to 9pm';

```

would love to get the output / rewrite it to

```
var time = '11:30 to 15:00, 17:00 to 21:00';

```