Last active
August 29, 2015 14:12
-
-
Save majie1993/6b8e848365845d461b2d to your computer and use it in GitHub Desktop.
NSString to NSDate
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
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSString* dateString = @"2015/12/9 00:10:00"; | |
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"yyyy/MM/dd hh:mm:ss"]; | |
NSDate* date = [dateFormatter dateFromString:dateString]; | |
NSString * updatedStr = [dateFormatter stringFromDate:date]; | |
NSLog(@"time %@", updatedStr); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment