Right now I have an NSDate set to be stored in NSUserDefaults. When I go to retrieve that date I want to extract and format the time. Can anyone tell me how to do this in Swift?
I have:
punchTimes.setObject(NSDate(), forKey: "punchInTime")
punchTimes.synchronize()
set to store date, and would like to retrieve the NSDate time for "punchInTime"
Retrieve the NSDate object from NSUserDefaults by calling punchTimes.objectForKey("punchInTime")
Then use NSDateFormatter class to create a String formatted the way you want it.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments