Skip to content

Instantly share code, notes, and snippets.

@tjarksaul
Forked from chris-79/set-date-time-formats.sh
Last active July 12, 2024 07:40
Show Gist options
  • Save tjarksaul/5ac55cd85d2f4a43475d33b7b04f7046 to your computer and use it in GitHub Desktop.
Save tjarksaul/5ac55cd85d2f4a43475d33b7b04f7046 to your computer and use it in GitHub Desktop.
Set my preferred date and time formats on OS X
# declare my US locale
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=EUR"
defaults write com.apple.systempreferences AppleIntlCustomFormat -dict-add "AppleIntlCustomLocale" "en_US"
# date string formats
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "1" "dd.MM.yy"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "2" "dd MMM yy"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "3" "dd MMMM yy"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "4" "EEEE, dd MMMM y"
# 24-hour time is the only way to roll
defaults write NSGlobalDomain AppleICUTimeFormatStrings -dict-add "1" "HH:mm"
defaults write NSGlobalDomain AppleICUTimeFormatStrings -dict-add "2" "HH:mm:ss"
defaults write NSGlobalDomain AppleICUTimeFormatStrings -dict-add "3" "HH:mm:ss z"
defaults write NSGlobalDomain AppleICUTimeFormatStrings -dict-add "4" "HH:mm:ss zzzz"
# also set this for the system preference
defaults write com.apple.systempreferences AppleIntlCustomFormat -dict-add "AppleIntlCustomICUDictionary" "{'AppleICUDateFormatStrings'={'1'='dd.MM.yy';'2'='dd MMM yy';'3'='dd MMMM yy';'4'='EEEE, dd MMMM yy';};'AppleICUTimeFormatStrings'={'1'='HH:mm';'2'='HH:mm:ss';'3'='HH:mm:ss z';'4'='HH:mm:ss zzzz';};}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment