Created
December 30, 2011 17:28
-
-
Save jinto/1540699 to your computer and use it in GitHub Desktop.
days and hours from birth date
This file contains 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/Foundation.h> | |
int main(int argc, const char *argv[]) | |
{ | |
NSString *birthd = @"1971-8-24 09:00:00 +0900"; | |
NSDate *from = [[NSDate alloc] initWithString:birthd]; | |
NSTimeInterval diff = [from timeIntervalSinceNow]; | |
int days = diff / 60 / 60 / 24; | |
int hours = ((int)diff/60/60) % 24; | |
printf("%d days and %d hours from %s\n", -days, -hours, [birthd UTF8String]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
나도 이제 objective c 코더 ! 예이!