Created
February 14, 2018 10:40
-
-
Save gin0606/9c523e83a29f86109fdd67f46607a042 to your computer and use it in GitHub Desktop.
rails の Timestamp を Date に変換できる format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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