Quantcast
Viewing all articles
Browse latest Browse all 37

Answer by Sargis for iOS Date format 28 Mar 2016 / 16:54pm

See Instruction or introduction with every line

NSString *str = @"your date here..."; /// here this is your date with format yyyyy-MM-dd'T'HH:mm:ss.SSSZNSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // here we create NSDateFormatter object for change the Format of date..[dateFormatter setDateFormat:@"yyyyy-MM-dd'T'HH:mm:ss.SSSZ"]; //// here set format of date which is in your output date (means above str with format)NSDate *date = [dateFormatter dateFromString: str]; // here you can fetch date from string with define formatdateFormatter = [[NSDateFormatter alloc] init];[dateFormatter setDateFormat:@"dd MMM yyyy / HH:mma"];// here set format which you want...NSString *convertedString = [dateFormatter stringFromDate:date]; //here convert date in NSStringNSLog(@"Converted String : %@",convertedString);

Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>