Skip to content

Instantly share code, notes, and snippets.

@LemonSpike
Created April 30, 2021 18:48
Show Gist options
  • Save LemonSpike/49bf7758ddaa2c287e67767764861b53 to your computer and use it in GitHub Desktop.
Save LemonSpike/49bf7758ddaa2c287e67767764861b53 to your computer and use it in GitHub Desktop.
Swift Date Formatter for ISO8601 timestamps
import Foundation
let dateFormatter = ISO8601DateFormatter()
let timestamp = "2021-04-30T18:11:29-06:00"
let date = dateFormatter.date(from: timestamp)
print(date) // 🎉 🤔 🎊
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment