Created
November 18, 2019 14:27
-
-
Save PetreVane/30fb39edb58b54534312b12618a17b50 to your computer and use it in GitHub Desktop.
Decodes Unix time in Time that has a significance
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 characters
func decodeDatefrom(_ unixTime: String) -> String? { | |
// converts comment date into meaningful date | |
var decodedDate: String? | |
if let unixTime = Double(unixTime) { | |
let dateFormatter = DateFormatter() | |
let date = Date(timeIntervalSince1970: unixTime) | |
dateFormatter.dateFormat = "dd.MM.yyyy" | |
decodedDate = dateFormatter.string(from: date) | |
} | |
return decodedDate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment