Skip to content

Instantly share code, notes, and snippets.

@perlmunger
Last active April 25, 2017 02:46
Show Gist options
  • Save perlmunger/ddafb785a11a6bba9f43cd3324d98c72 to your computer and use it in GitHub Desktop.
Save perlmunger/ddafb785a11a6bba9f43cd3324d98c72 to your computer and use it in GitHub Desktop.

Revisions

  1. perlmunger revised this gist Apr 25, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Date+ISO8601.swift
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // ISO 8601 Extension for Swift to send dates to Ruby on Rails
    extension Date {
    init(dateString:String) {
    self = Date.iso8601Formatter.date(from: dateString)!
  2. perlmunger revised this gist Apr 25, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Date+ISO8601.swift
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,3 @@ extension Date {
    }()
    }

    http://stackoverflow.com/questions/28016578/swift-how-to-create-a-date-time-stamp-and-format-as-iso-8601-rfc-3339-utc-tim#42101630
  3. perlmunger created this gist Apr 25, 2017.
    16 changes: 16 additions & 0 deletions Date+ISO8601.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    extension Date {
    init(dateString:String) {
    self = Date.iso8601Formatter.date(from: dateString)!
    }

    static let iso8601Formatter: ISO8601DateFormatter = {
    let formatter = ISO8601DateFormatter()
    formatter.formatOptions = [.withFullDate,
    .withTime,
    .withDashSeparatorInDate,
    .withColonSeparatorInTime]
    return formatter
    }()
    }

    http://stackoverflow.com/questions/28016578/swift-how-to-create-a-date-time-stamp-and-format-as-iso-8601-rfc-3339-utc-tim#42101630