Type Method


Creates a representation of the specified date with a given time zone and format options.


+ (NSString *)stringFromDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone formatOptions:(NSISO8601DateFormatOptions)formatOptions;



The date to be represented.


The time zone used.


The options used. For possible values, see NSISO8601DateFormatOptions.

Return Value

A user-readable string representing the date.


This method uses a date formatter configured with the specified time zone and format options. The following code examples produce the same string value:

NSDate *date = [NSDate date];
NSString *string;
NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init];
string = [formatter stringFromDate:date];
NSTimeZone *GMT = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
NSISO8601DateFormatOptions options = NSISO8601DateFormatWithInternetDateTime | NSISO8601DateFormatWithDashSeparatorInDate | NSISO8601DateFormatWithColonSeparatorInTime | NSISO8601DateFormatWithTimeZone;
string = [NSISO8601DateFormatter stringFromDate:date timeZone:GMT formatOptions:options];

See Also

Converting ISO 8601 Dates

- stringFromDate:

Creates and returns an ISO 8601 formatted string representation of the specified date.

- dateFromString:

Creates and returns a date object from the specified ISO 8601 formatted string representation.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software