IOS 字符串转日期

//字符串转日期

- (NSDate *)StringTODate:(NSString *)sender

{

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

    dateFormatter.dateFormat = @"YYYY-MM-dd HH:mm:ss";

    [dateFormatter setMonthSymbols:[NSArray arrayWithObjects:@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12", nil]];

    NSDate * ValueDate = [dateFormatter dateFromString:sender];

    return ValueDate;

}


你可能感兴趣的:(日期计算)