خرید بک لینک

Vote count: 0

I try to convert my NSString to NSDate object, but NSDateFormatter retus me a strange value. i want to 01/07/2016 but it will retu wrong output out put is Today: 2015-12-20 00:00:00 +0000 Here is code:

NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];

NSInteger day = 01;
NSInteger week = 07;
NSInteger year = [components year];

NSString *string = [NSString stringWithFormat:@"%ld/%ld/%ld",  (long)week,(long)day, (long)year];

NSLog(@"Min Date: %@",string);

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

[dateformate setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];

[dateformate setDateFormat:@"MM/dd/YY"];

strMinDate = [dateformate dateFromString:string];

NSLog(@"Today: %@", strMinDate);

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 4 خرداد 1395 ساعت: 12:36

صفحه بندی