Skip to content

Instantly share code, notes, and snippets.

@chris-79
Created August 6, 2015 14:30
Show Gist options
  • Save chris-79/654bfcd252280230fa82 to your computer and use it in GitHub Desktop.
Save chris-79/654bfcd252280230fa82 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=USD"
defaults write com.apple.systempreferences AppleIntlCustomFormat -dict-add "AppleIntlCustomLocale" "en_US"
# date string formats
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "1" "yyyy/MM/dd"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "2" "dd MMM y"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "3" "dd MMMM y"
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'='yyyy/MM/dd';'2'='dd MMM y';'3'='dd MMMM y';'4'='EEEE, dd MMMM y';};'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