Skip to content

Instantly share code, notes, and snippets.

@antocara
Created March 14, 2022 13:05
Show Gist options
  • Save antocara/5944a5a9f9108cbd0bb170ec9afaea0d to your computer and use it in GitHub Desktop.
Save antocara/5944a5a9f9108cbd0bb170ec9afaea0d to your computer and use it in GitHub Desktop.
func formatResponseHeaderDate() -> Date?{
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSIX") // set locale to reliable US_POSIX
dateFormatter.dateFormat = "EEE,d MMM yyyy HH:mm:ss zzz"
dateFormatter.timeZone = TimeZone(abbreviation: "GMT")
return dateFormatter.date(from: self)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment