Skip to content

Instantly share code, notes, and snippets.

View welsonla's full-sized avatar
💬
I may be slow to respond.

welsonla welsonla

💬
I may be slow to respond.
View GitHub Profile
@welsonla
welsonla / snipt.m
Last active October 3, 2015 05:08
一些常用的object-c片段
````
//DataFormatter with 'T' string
@implementation NSString (DateParse)
-(NSDate *) dateFromISO8601 {
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
NSString *format = ([self hasSuffix:@"Z"]) ? @"yyyy-MM-dd'T'HH:mm:ss'Z'" : @"yyyy-MM-dd'T'HH:mm:ssz";
[formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[formatter setDateFormat:format];