Created
April 8, 2020 05:59
-
-
Save jeffery812/ef534ac0b7f30f2ff44c4f66ad0afc4a to your computer and use it in GitHub Desktop.
Revisions
-
jeffery812 created this gist
Apr 8, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // https://stackoverflow.com/questions/33145005/swift-nsdateformatter-not-using-correct-locale-and-format/61094162#61094162 extension Date { var timestamp: String { let dataFormatter = DateFormatter() dataFormatter.locale = Locale(identifier: "en_US_POSIX") dataFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS" return String(format: "%@", dataFormatter.string(from: self)) } }