Skip to content

Instantly share code, notes, and snippets.

@fonkadelic
Created January 30, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fonkadelic/edcff1c1884267f8bc2a1e0ef83e6c43 to your computer and use it in GitHub Desktop.
Save fonkadelic/edcff1c1884267f8bc2a1e0ef83e6c43 to your computer and use it in GitHub Desktop.
let now = Date()
func format(withIdentifier identifier: String) -> String {
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: identifier)
dateFormatter.setLocalizedDateFormatFromTemplate("EEEE, MMMM d, yyyy")
return dateFormatter.string(from: now)
}
format(withIdentifier: "de_DE")
format(withIdentifier: "en_US")
format(withIdentifier: "ja_JP")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment