Created
October 7, 2015 05:04
-
-
Save paulw11/d6b1be47d3f6bc20eaf6 to your computer and use it in GitHub Desktop.
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
import Foundation | |
var dateComponents = NSDateComponents() | |
dateComponents.day = 19 | |
dateComponents.month = 12 | |
dateComponents.year = 2015 | |
let birthDate = NSCalendar(identifier: NSCalendarIdentifierGregorian)!.dateFromComponents(dateComponents)! | |
let durationDateComponents = NSCalendar(identifier: NSCalendarIdentifierGregorian)!.components( [.Year, .Month, .Day, .Hour, .Minute, .Second], fromDate: NSDate(), toDate:birthDate, options: []) | |
let yearsLabel = "\(durationDateComponents.year)" | |
let monthsLabel = "\(durationDateComponents.month)" | |
let daysLabel = "\(durationDateComponents.day)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment