How do I convert epochTime to current local time? Essentially, in below codes, how do I get 1 and 2 to produce the same time?
var epochTime = (NSDate().timeIntervalSince1970)
//1. Convert epochTime to NSDate(). Shows "2016-06-14 22:47:23 +0000n"
print(NSDate(timeIntervalSince1970: epochTime))
//2. local time using NSDate(). Shows "Jun 14, 2016, 6:47 PM"
NSDate()
Aucun commentaire:
Enregistrer un commentaire