3

It used to be possible to freely customize the system date format in Mac OS preferences up to some 10.x version with a nice and flexible editor. screenshot old OS version

In current Ventura, there’s only a selection of predefined formats and only for the short version. Ventura screenshot

In Shortcuts, for instance, (almost) all placeholders from UTS #35 can be used, so internal support is there, of course.

Is there some hidden way to still customize the formats? For instance, I want to include the calendar week as in ISO 8601’s yyyy-'W'ww-d.

Extra points if this format then can be used in the system clock.

1

1 Answer 1

2

The hint and link from @aivar-paalberg helped a lot.

The date format settings are stored in the hidden file ~/Library/Preferences/.GlobalPreferences.plist. Values can be queried with defaults in Terminal.app and also be changed using defaults write.

Getting

% defaults find AppleICU
Found 1 keys in domain 'Apple Global Domain': {
    AppleICUDateFormatStrings =     {
        1 = "y-MM-dd";
        2 = "y-MM-dd";
    };
}

1 is short, 2 is medium, 3 is long and 4 is full in the CLDR date formats (with precision to the calendar day).

Setting

defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "1" "yyyyMMdd"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "2" "d. MMM ’yy"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "3" "d. MMMM yyyy"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "4" "EEEE 'KW'ww, d. MMMM yyyy"

Unfortunately, System Settings will not show an example result in the dropdown if it differs from the predefined formats:
empty dropdown

For English-language locales alone, the formats will default to a number of variants, as of CLDR v43:

  • short with month number:
    • M/d/yy default = US
    • d-M-yy MV
    • d/M/y HK, ZW
    • d/M/yy AU, JM, SG
    • d/MM/yy NZ
    • dd.MM.y CH
    • dd/MM/y int., AE, GB
    • dd/MM/yy BE, BW, MZ, IN
    • y-MM-dd CA, SE
    • y/MM/dd ZA
    • ISO 8601, shortest formats:
      • yyyyDDD ordinal day of the year
      • yyyyMMdd day of the month of the year
      • YYYY'W'wwe day of the week of the year
      • yyMMdd and yy-MM-dd with implied century were supported before the 2004 revision.
  • medium with abbreviated month name or number:
    • MMM d, y default = US
    • d MMM y int., AE, GB
    • d/MM/y NZ
    • dd MMM y BE, BW, MT, ZA
    • dd MMM,y ZW
    • dd-MM-y MV
    • dd-MMM-y BZ, IN, PK
    • ISO 8601:
      • yyyy-DDD
      • yyyy-MM-dd
      • YYYY-'W'ww-e
  • long with complete month name:
    • MMMM d, y default = US
    • d MMMM y int., AE, GB, MV
    • dd MMMM y BW, BZ, MT, ZA, ZW
  • full with day of the week:
    • EEEE, MMMM d, y default = US
    • EEEE d MMMM y IE, MV
    • EEEE, d MMMM y int., AE, GB
    • EEEE, d MMMM, y IN
    • EEEE, dd MMMM y BW, BZ, ZA, ZW

Apple / ICU supports all Date Field Symbols from UTS #35.

PS: I assume those AppleICUDateFormatStrings are used internally as the default template somewhere in DateFormatter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .