Skip to content

Instantly share code, notes, and snippets.

@likil33
Created March 16, 2023 10:08
Show Gist options
  • Select an option

  • Save likil33/a3144310920f21bae2b03974294e5ae1 to your computer and use it in GitHub Desktop.

Select an option

Save likil33/a3144310920f21bae2b03974294e5ae1 to your computer and use it in GitHub Desktop.
DateFormat
func dateSetup(_ dateStr:String) -> String {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
let dateString = formatter.date(from: dateStr)
formatter.dateFormat = "MM-dd-yyyy"
return formatter.string(from: dateString ?? Date())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment