I'd like to take a ISO8601 timestamp, like this: YYYY-MM-DDTHH:MM:SSZ
, and convert it to a Unix epoch time stamp using Swift.
ISO8601DateFormatter
converts the string to Date
, timeIntervalSince1970
gets the UNIX timestamp.
let timestamp = ISO8601DateFormatter().date(from: "2017-07-14T20:00:00Z")!.timeIntervalSince1970