Skip to content

Instantly share code, notes, and snippets.

@gin0606
Created February 14, 2018 10:40
Show Gist options
  • Save gin0606/9c523e83a29f86109fdd67f46607a042 to your computer and use it in GitHub Desktop.
Save gin0606/9c523e83a29f86109fdd67f46607a042 to your computer and use it in GitHub Desktop.
rails の Timestamp を Date に変換できる format
let timestamp = "2017-07-03T17:00:00.000Z"
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
let date = formatter.date(from: timestamp)!
print(date) // => 2017-07-03 17:00:00 +0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment