1〉NSDateFormatter ,设置日期格式;
2>NSLocale ,设置时区;
3〉df dateFromString:birthday;将字符格式发到日期格式;
@implementation Person
@systhesize fistName,lastName,birthDate,salary;
- (NSDate *)makeBirthDate:(NSString *)birthday
{
NSDateFormatter df=[[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];//[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSLocale *locale=[[NSLocale alloc] initWithLocaleIdentifier:@"en-US"];
[df setLocale:locale];
NSDate *date=[df dateFromString:birthday];
[df release];
[ locale release];
return date;
}