Created
April 2, 2014 08:24
-
-
Save congbo/9930108 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
+ (NSDate*)_getDateBySecondFormat:(NSDate*)date | |
{ | |
return [self _getDateByFormat:date | |
Format:@"yyyy/MM/dd HH:mm"]; | |
} | |
+ (NSDate*)_getDateByFormat:(NSDate*)date Format:(NSString*)format | |
{ | |
NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; | |
[formatter setDateFormat:format]; | |
NSString *dateStr = [formatter stringFromDate:date]; | |
return [formatter dateFromString: dateStr]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment