Generate all months names in an array?

NSArray *monthlySymbols = [[[NSDateFormatter alloc] init] shortMonthSymbols];

Convert Date to String

NSDate *yourDate = //...;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
NSString *yourDateString = [dateFormat stringFromDate: yourDate];

Convert String to Date

NSString *yourDateString = @"2007-08-11T19:30:00Z";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
NSDate *yourDate = [dateFormat dateFromString: yourDateString];

Convert a date string to another format of date string

NSString *inputDateString = @"2007-08-11T19:30:00Z";
NSString *outputDateString = [NSDateFormatter
    dateStringFromString:inputDateString
    sourceFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"
    destinationFormat:@"h:mm:ssa 'on' MMMM d, yyyy"];

results matching ""

    No results matching ""