[code]
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:2005];
[comps setMonth:01];
[comps setDay:01];
[comps setHour:01];
[comps setMonth:01];
[comps setSecond:01];
NSCalendar *g = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *dateOfbirth = [g dateFromComponents:comps];
NSDate *now = [NSDate date];
double d = [now timeIntervalSinceDate:dateOfbirth];
NSLog(@”지난 시간 %f”, d);
}
return 0;
}
[/code]
댓글