Changing the time format from 24 hours to 12 (AM / PM)?

In Firefox I want the times in the history menu to say for instance, “4:26PM” instead of 16:26. I looked it up and asked on the support site, and it seems to be determined by OS settings.

This one is Firefox-specific I think. It’s displayed as 16.26 for me, in fact, which isn’t any standard time format I’m aware of.

The generic internationalization settings in turn are basically just the stuff glib exposes through the LC variables. The default is en-us, so you’d likely already have that set to AM/PM. Still, here’s how I make my date/time show up as ISO 8601:

  i18n = {
    supportedLocales = [
      "en_US.UTF-8/UTF-8"
      "en_DK.UTF-8/UTF-8"
    ];

    extraLocaleSettings = {
      LC_MESSAGES = "en_US.UTF-8";
      LC_TIME = "en_DK.UTF-8";
    };
  };
1 Like

I still don’t know what settings will make the time be AM/PM.

Right, my point was that your OS settings are already AM/PM, unless you changed the settings I mention.

For Firefox history, you’ll probably have to ask around Firefox forums rather than here. That said, I looked around a little, this Firefox pref looks promising:

# Using NixOS to configure Firefox because explaining
# about:config is a PITA; make sure you don't install
# Firefox with `home.packages` or
# `environment.systemPackages`
programs.firefox = {
  enable = true;
  preferences = {
    "intl.regional_prefs.use_os_locales" = true;
  };
}

YMMV, I don’t know if this actually works.

The pref doesn’t do anything, and I’ve already asked in firefox forums.

Right, type date into a terminal. If you get the time with AM/PM markers, go back to the Firefox forums and tell them your OS settings are set to AM/PM, and ask how you can make Firefox respect the OS settings for time in the history menu.

If you don’t get AM/PM time, set explicitly in your config:

i18n = {
  supportedLocales = [
    "en_US.UTF-8/UTF-8"
  ];

  extraLocaleSettings.LC_TIME = "en_US.UTF-8";
}

This is the default setting though, and you don’t mention changing that, so I doubt date will give you the wrong format.


Someone else could chime in with an answer here, but Firefox settings are horrendously documented and hidden away behind about:config, which contains lots of settings that aren’t actually settings but really cached data and so it is hard to figure out anything by experimentation.

Chances are low you’ll get an answer unless you speak to someone who is a bit of an expert on Firefox. You’re more likely to find someone like that on the Firefox forums.

I copied that into my config then reloaded and rebooted.

Both nixos-option i18n.extraLocaleSettings and nixos-option i18n.defaultLocale shows Value: "en_US.UTF-8".

date shows Sat Jun 14 16:23:30 EDT 2025 before and after.

Ah, the plot thickens! What about echo $LANG $LC_TIME $LC_ALL?

> echo $LANG $LC_TIME $LC_ALL
en_US.UTF-8 en_US.UTF-8

$LC_ALL doesn’t show anything.

extraLocaleSettings.LC_ALL = "en_US.UTF-8"; does not work either with a rebuild and a reboot.

Now echo $LC_ALL shows en_US.UTF-8.

@TLATER I got it! I was using uutils-coreutils whose date outputted a different date format! So I filed this issue. Gnu coreutils’ date shows Sun Jun 15 09:09:40 PM EDT 2025. I removed all i18n settings then rebuild and rebooted. date shows the same format, i turns out my device was to 12 hour format the whole time!

For Firefox, there’s this open issue: Date not formatted according to user’s locale (LC_TIME). I found this this bugzilla comment which links to this page for time formatting. I changed intl.date_time.pattern_override.time_short to h:mm a so it shows 4:26PM.

Thanks for bearing through this issue with me!