ARTICLE AD BOX
I want to show the user a timestamp based on their preference, i.e. the system locale. I want to format the time depending on if they're using a time locale that normally shows a 12-hour time, or 24-hour time format. This should be in a cross-platform manner.
It seems the stdlib pretty much says l10n and i18n is not in scope for anything. I found many libraries focused on translation, formatting currencies and dates, and lots of guides for how to get the time in a timezone which is not what I'm asking for.
Essentially I want:
time.Now().Format("15:04:05")or
time.Now().Format("3:04:05pm")depending on which is appropriate for the system settings.
Or put in another way, I want a Golang equivalent for the JS code new Date().toLocaleTimeString() .
