| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSDateFormatter.h |
| Related sample code |
Instances of NSDateFormatter create string representations of NSDate (and NSCalendarDate) objects, and convert textual representations of dates and times into NSDate objects. You can express the representation of dates and times flexibly: “Thu 22 Dec 1994” is just as acceptable as “12/22/94.”
With Mac OS X v10.4 and later, NSDateFormatter has two modes of operation (or behaviors). By default, instances of NSDateFormatter have the same behavior as they did on Mac OS X versions 10.0 to 10.3. You can, however, configure instances (or set a default for all instances) to adopt a new behavior implemented for Mac OS X version 10.4. See Data Formatting Programming Guide for Cocoa for a full description of the old and new behaviors.
iPhone OS Note: iPhone OS supports only the modern 10.4+ behavior. 10.0-style methods and format strings are not available on iPhone OS.
If you initialize a formatter using initWithDateFormat:allowNaturalLanguage:, you are (for backwards compatibility reasons) creating an “old-style” date formatter. To use the new behavior, you initialize the formatter with init. If you have not set the default class behavior (see setDefaultFormatterBehavior:), you send the instance a setFormatterBehavior: message with the argument NSDateFormatterBehavior10_4. You can then set the date format as appropriate, typically using a format style as illustrated in the following code fragment.
// assume default behavior set for class using |
// [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; |
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; |
[dateFormatter setDateStyle:NSDateFormatterMediumStyle]; |
[dateFormatter setTimeStyle:NSDateFormatterNoStyle]; |
NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:118800]; |
NSString *formattedDateString = [dateFormatter stringFromDate:date]; |
NSLog(@"formattedDateString for locale %@: %@", |
[[dateFormatter locale] localeIdentifier], formattedDateString); |
// Output: formattedDateString for locale en_US: Jan 2, 2001 |
Note that the format for a given style is dependent on a user’s preferences, including the locale setting.
Note also that by default the new-style formatter returns NSDate objects instead of NSCalendarDate objects. You can change this behavior using setGeneratesCalendarDates:.
– allowsNaturalLanguage
– formatterBehavior
– setFormatterBehavior:
+ defaultFormatterBehavior
+ setDefaultFormatterBehavior:
– generatesCalendarDates
– setGeneratesCalendarDates:
– isLenient
– setLenient:
– calendar
– setCalendar:
– defaultDate
– setDefaultDate:
– locale
– setLocale:
– timeZone
– setTimeZone:
– twoDigitStartDate
– setTwoDigitStartDate:
– gregorianStartDate
– setGregorianStartDate:
– weekdaySymbols
– setWeekdaySymbols:
– shortWeekdaySymbols
– setShortWeekdaySymbols:
– veryShortWeekdaySymbols
– setVeryShortWeekdaySymbols:
– standaloneWeekdaySymbols
– setStandaloneWeekdaySymbols:
– shortStandaloneWeekdaySymbols
– setShortStandaloneWeekdaySymbols:
– veryShortStandaloneWeekdaySymbols
– setVeryShortStandaloneWeekdaySymbols:
– monthSymbols
– setMonthSymbols:
– shortMonthSymbols
– setShortMonthSymbols:
– veryShortMonthSymbols
– setVeryShortMonthSymbols:
– standaloneMonthSymbols
– setStandaloneMonthSymbols:
– shortStandaloneMonthSymbols
– setShortStandaloneMonthSymbols:
– veryShortStandaloneMonthSymbols
– setVeryShortStandaloneMonthSymbols:
– quarterSymbols
– setQuarterSymbols:
– shortQuarterSymbols
– setShortQuarterSymbols:
– standaloneQuarterSymbols
– setStandaloneQuarterSymbols:
– shortStandaloneQuarterSymbols
– setShortStandaloneQuarterSymbols:
Returns the default formatting behavior for instances of the class.
+ (NSDateFormatterBehavior)defaultFormatterBehavior
The default formatting behavior for instances of the class. For possible values, see NSDateFormatterBehavior.
The default is NSDateFormatterBehavior10_0.
NSDateFormatter.h
Sets the default formatting behavior for instances of the class.
+ (void)setDefaultFormatterBehavior:(NSDateFormatterBehavior)behavior
The default formatting behavior for instances of the class. For possible values, see NSDateFormatterBehavior.
NSDateFormatter.hReturns a Boolean value that indicates whether the receiver attempts to process dates entered as a vernacular string.
- (BOOL)allowsNaturalLanguage
YES if the receiver attempts to process dates entered as a vernacular string ("today," "next week," "dinner time," and so on), otherwise NO.
Natural-language processing supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged.
This method is for use with formatters using NSDateFormatterBehavior10_0 behavior.
NSDateFormatter.hReturns the AM symbol for the receiver.
- (NSString *)AMSymbol
The AM symbol for the receiver.
NSDateFormatter.hReturns the calendar for the receiver.
- (NSCalendar *)calendar
The calendar for the receiver.
NSDateFormatter.hReturns the date format string used by the receiver.
- (NSString *)dateFormat
The date format string used by the receiver.
See Date Format String Syntax (Mac OS X Versions 10.0 to 10.3) for a list of the conversion specifiers permitted in date format strings.
NSDateFormatter.hReturns a date representation of a given string interpreted using the receiver’s current settings.
- (NSDate *)dateFromString:(NSString *)string
The string to parse.
A date representation of string interpreted using the receiver’s current settings.
NSDateFormatter.hReturns the date style of the receiver.
- (NSDateFormatterStyle)dateStyle
The date style of the receiver. For possible values, see NSDateFormatterStyle.
NSDateFormatter.hReturns the default date for the receiver.
- (NSDate *)defaultDate
The default date for the receiver.
The default default date is nil.
NSDateFormatter.hReturns the era symbols for the receiver.
- (NSArray *)eraSymbols
An array containing NSString objects representing the era symbols for the receiver (for example, {“B.C.E.”, “C.E.”}).
NSDateFormatter.hReturns the formatter behavior for the receiver.
- (NSDateFormatterBehavior)formatterBehavior
The formatter behavior for the receiver. For possible values, see NSDateFormatterBehavior.
NSDateFormatter.hReturns a Boolean value that indicates whether the receiver generates calendar dates.
- (BOOL)generatesCalendarDates
YES if the receiver generates calendar dates, otherwise NO.
NSDateFormatter.hReturns by reference a date representation of a given string and the range of the string used, and returns a Boolean value that indicates whether the string could be parsed.
- (BOOL)getObjectValue:(id *)obj forString:(NSString *)string range:(inout NSRange *)rangep error:(NSError **)error
If the receiver is able to parse string, upon return contains a date representation of string.
The string to parse.
If the receiver is able to parse string, upon return contains the range of string used to create the date.
If the receiver is unable to create a date by parsing string, upon return contains an NSError object that describes the problem.
YES if the receiver can create a date by parsing string, otherwise NO.
NSDateFormatter.hReturns the start date of the Gregorian calendar for the receiver.
- (NSDate *)gregorianStartDate
The start date of the Gregorian calendar for the receiver.
NSDateFormatter.hInitializes and returns an NSDateFormatter instance.
- (id)init
An NSDateFormatter instance initialized with locale, time zone, calendar, and behavior set to the appropriate default values.
There are many new attributes you can get and set on a 10.4-style date formatter, including the locale, time zone, calendar, format string, the two-digit-year cross-over date, the default date which provides unspecified components, and there is also access to the various textual strings, like the month names. You are encouraged, however, not to change individual settings. Instead you should accept the default settings established on initialization and specify the format using setDateStyle:, setTimeStyle:, and appropriate style constants (see NSDateFormatterStyle—these are styles that the user can configure in the International preferences panel in System Preferences).
If you want the Mac OS X 10.4 behavior but have not set the class’s default behavior to NSDateFormatterBehavior10_4, you also need to send the new instance a setFormatterBehavior: message with the argument NSDateFormatterBehavior10_4.
NSDateFormatter.hInitializes and returns an NSDateFormatter instance that uses the Mac OS X v10.0 formatting behavior and the given date format string in its conversions.
- (id)initWithDateFormat:(NSString *)format allowNaturalLanguage:(BOOL)flag
The format for the receiver. See Date Format String Syntax (Mac OS X Versions 10.0 to 10.3) for a list of conversion specifiers permitted in date format strings.
A flag that specifies whether the receiver should process dates entered as expressions in the vernacular (for example, "tomorrow")—YES means that it should.
An initialized NSDateFormatter instance that uses format in its conversions and that uses the Mac OS X v10.0 formatting behavior.
NSDateFormatter attempts natural-language processing only after it fails to interpret an entered string according to format. Natural-language processing supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged.
The following example creates a date formatter with the format string (for example) “Mar 15 1994” and then associates the formatter with the cells of a form (contactsForm):
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] |
initWithDateFormat:@"%b %d %Y" allowNaturalLanguage:NO]; |
[[contactsForm cells] makeObjectsPerformSelector:@selector(setFormatter:) |
withObject:dateFormat]; |
Important: You cannot use this method to initialize a formatter with the Mac OS X v10.4 formatting behavior, you must use init.
NSDateFormatter.hReturns a Boolean value that indicates whether the receiver uses heuristics when parsing a string.
- (BOOL)isLenient
YES if the receiver has been set to use heuristics when parsing a string to guess at the date which is intended, otherwise NO.
NSDateFormatter.hReturns the locale for the receiver.
- (NSLocale *)locale
The locale for the receiver.
NSDateFormatter.hReturns the long era symbols for the receiver
- (NSArray *)longEraSymbols
An array containing NSString objects representing the era symbols for the receiver (for example, {“Before Common Era”, “Common Era”}).
NSDateFormatter.hReturns the month symbols for the receiver.
- (NSArray *)monthSymbols
An array of NSString objects that specify the month symbols for the receiver.
– setMonthSymbols:– shortMonthSymbols– veryShortMonthSymbols– standaloneMonthSymbols– shortStandaloneMonthSymbols– veryShortStandaloneMonthSymbolsNSDateFormatter.hReturns the PM symbol for the receiver.
- (NSString *)PMSymbol
The PM symbol for the receiver.
NSDateFormatter.hReturns the quarter symbols for the receiver.
- (NSArray *)quarterSymbols
An array containing NSString objects representing the quarter symbols for the receiver.
– setQuarterSymbols:– shortQuarterSymbols– standaloneQuarterSymbols– shortStandaloneQuarterSymbolsNSDateFormatter.hSets the AM symbol for the receiver.
- (void)setAMSymbol:(NSString *)string
The AM symbol for the receiver.
NSDateFormatter.hSets the calendar for the receiver.
- (void)setCalendar:(NSCalendar *)calendar
The calendar for the receiver.
NSDateFormatter.hSets the date format for the receiver.
- (void)setDateFormat:(NSString *)string
The date format for the receiver. See Data Formatting Programming Guide for Cocoa for a list of the conversion specifiers permitted in date format strings.
NSDateFormatter.hSets the date style of the receiver.
- (void)setDateStyle:(NSDateFormatterStyle)style
The date style of the receiver. For possible values, see NSDateFormatterStyle.
NSDateFormatter.hSets the default date for the receiver.
- (void)setDefaultDate:(NSDate *)date
The default date for the receiver.
NSDateFormatter.hSets the era symbols for the receiver.
- (void)setEraSymbols:(NSArray *)array
An array containing NSString objects representing the era symbols for the receiver (for example, {“B.C.E.”, “C.E.”}).
NSDateFormatter.hSets the formatter behavior for the receiver.
- (void)setFormatterBehavior:(NSDateFormatterBehavior)behavior
The formatter behavior for the receiver. For possible values, see NSDateFormatterBehavior.
NSDateFormatter.hSets whether the receiver generates calendar dates.
- (void)setGeneratesCalendarDates:(BOOL)b
A Boolean value that specifies whether the receiver generates calendar dates.
NSDateFormatter.hSets the start date of the Gregorian calendar for the receiver.
- (void)setGregorianStartDate:(NSDate *)array
The start date of the Gregorian calendar for the receiver.
NSDateFormatter.hSets whether the receiver uses heuristics when parsing a string.
- (void)setLenient:(BOOL)b
YES to use heuristics when parsing a string to guess at the date which is intended, otherwise NO.
If a formatter is set to be lenient, when parsing a string it uses heuristics to guess at the date which is intended. As with any guessing, it may get the result date wrong (that is, a date other than that which was intended).
NSDateFormatter.hSets the locale for the receiver.
- (void)setLocale:(NSLocale *)locale
The locale for the receiver.
NSDateFormatter.hSets the long era symbols for the receiver.
- (void)setLongEraSymbols:(NSArray *)array
An array containing NSString objects representing the era symbols for the receiver (for example, {“Before Common Era”, “Common Era”}).
NSDateFormatter.hSets the month symbols for the receiver.
- (void)setMonthSymbols:(NSArray *)array
An array of NSString objects that specify the month symbols for the receiver.
– monthSymbols– setShortMonthSymbols:– setVeryShortMonthSymbols:– setStandaloneMonthSymbols:– setShortStandaloneMonthSymbols:– setVeryShortStandaloneMonthSymbols:NSDateFormatter.hSets the PM symbol for the receiver.
- (void)setPMSymbol:(NSString *)string
The PM symbol for the receiver.
NSDateFormatter.hSets the quarter symbols for the receiver.
- (void)setQuarterSymbols:(NSArray *)array
An array of NSString objects that specify the quarter symbols for the receiver.
– quarterSymbols– setShortQuarterSymbols:– setStandaloneQuarterSymbols:– setShortStandaloneQuarterSymbols:NSDateFormatter.hSets the short month symbols for the receiver.
- (void)setShortMonthSymbols:(NSArray *)array
An array of NSString objects that specify the short month symbols for the receiver.
– shortMonthSymbols– setMonthSymbols:– setVeryShortMonthSymbols:– setStandaloneMonthSymbols:– setShortStandaloneMonthSymbols:– setVeryShortStandaloneMonthSymbols:NSDateFormatter.hSets the short quarter symbols for the receiver.
- (void)setShortQuarterSymbols:(NSArray *)array
An array of NSString objects that specify the short quarter symbols for the receiver.
– shortQuarterSymbols– setQuarterSymbols:– setStandaloneQuarterSymbols:– setShortStandaloneQuarterSymbols:NSDateFormatter.hSets the short standalone month symbols for the receiver.
- (void)setShortStandaloneMonthSymbols:(NSArray *)array
An array of NSString objects that specify the short standalone month symbols for the receiver.
– shortStandaloneMonthSymbols– setMonthSymbols:– setShortMonthSymbols:– setVeryShortMonthSymbols:– setStandaloneMonthSymbols:– setVeryShortStandaloneMonthSymbols:NSDateFormatter.hSets the short standalone quarter symbols for the receiver.
- (void)setShortStandaloneQuarterSymbols:(NSArray *)array
An array of NSString objects that specify the short standalone quarter symbols for the receiver.
– shortStandaloneQuarterSymbols– setQuarterSymbols:– setShortQuarterSymbols:– setStandaloneQuarterSymbols:NSDateFormatter.hSets the short standalone weekday symbols for the receiver.
- (void)setShortStandaloneWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the short standalone weekday symbols for the receiver.
– shortStandaloneWeekdaySymbols– setWeekdaySymbols:– setShortWeekdaySymbols:– setVeryShortWeekdaySymbols:– setStandaloneWeekdaySymbols:– setVeryShortStandaloneWeekdaySymbols:NSDateFormatter.hSets the short weekday symbols for the receiver.
- (void)setShortWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the short weekday symbols for the receiver.
– shortWeekdaySymbols– setWeekdaySymbols:– setVeryShortWeekdaySymbols:– setStandaloneWeekdaySymbols:– setShortStandaloneWeekdaySymbols:– setVeryShortStandaloneWeekdaySymbols:NSDateFormatter.hSets the standalone month symbols for the receiver.
- (void)setStandaloneMonthSymbols:(NSArray *)array
An array of NSString objects that specify the standalone month symbols for the receiver.
– standaloneMonthSymbols– setMonthSymbols:– setShortMonthSymbols:– setVeryShortMonthSymbols:– setShortStandaloneMonthSymbols:– setVeryShortStandaloneMonthSymbols:NSDateFormatter.hSets the standalone quarter symbols for the receiver.
- (void)setStandaloneQuarterSymbols:(NSArray *)array
An array of NSString objects that specify the standalone quarter symbols for the receiver.
– setStandaloneQuarterSymbols:– setQuarterSymbols:– setShortQuarterSymbols:– setShortStandaloneQuarterSymbols:NSDateFormatter.hSets the standalone weekday symbols for the receiver.
- (void)setStandaloneWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the standalone weekday symbols for the receiver.
– standaloneWeekdaySymbols– setWeekdaySymbols:– setShortWeekdaySymbols:– setVeryShortWeekdaySymbols:– setShortStandaloneWeekdaySymbols:– setVeryShortStandaloneWeekdaySymbols:NSDateFormatter.hSets the time style of the receiver.
- (void)setTimeStyle:(NSDateFormatterStyle)style
The time style for the receiver. For possible values, see NSDateFormatterStyle.
NSDateFormatter.hSets the time zone for the receiver.
- (void)setTimeZone:(NSTimeZone *)tz
The time zone for the receiver.
NSDateFormatter.hSets the two-digit start date for the receiver.
- (void)setTwoDigitStartDate:(NSDate *)date
The earliest date that can be denoted by a two-digit year specifier.
NSDateFormatter.hSets the very short month symbols for the receiver.
- (void)setVeryShortMonthSymbols:(NSArray *)array
An array of NSString objects that specify the very short month symbols for the receiver.
– veryShortMonthSymbols– setMonthSymbols:– setShortMonthSymbols:– setStandaloneMonthSymbols:– setShortStandaloneMonthSymbols:– setVeryShortStandaloneMonthSymbols:NSDateFormatter.hSets the very short standalone month symbols for the receiver.
- (void)setVeryShortStandaloneMonthSymbols:(NSArray *)array
An array of NSString objects that specify the very short standalone month symbols for the receiver.
– veryShortStandaloneMonthSymbols– setMonthSymbols:– setShortMonthSymbols:– setVeryShortMonthSymbols:– setStandaloneMonthSymbols:– setShortStandaloneMonthSymbols:NSDateFormatter.hSets the very short standalone weekday symbols for the receiver.
- (void)setVeryShortStandaloneWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the very short standalone weekday symbols for the receiver.
– veryShortStandaloneWeekdaySymbols– setWeekdaySymbols:– setShortWeekdaySymbols:– setVeryShortWeekdaySymbols:– setStandaloneWeekdaySymbols:– setShortStandaloneWeekdaySymbols:NSDateFormatter.hSets the vert short weekday symbols for the receiver
- (void)setVeryShortWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the very short weekday symbols for the receiver.
– veryShortWeekdaySymbols– setWeekdaySymbols:– setShortWeekdaySymbols:– setStandaloneWeekdaySymbols:– setShortStandaloneWeekdaySymbols:– setVeryShortStandaloneWeekdaySymbols:NSDateFormatter.hSets the weekday symbols for the receiver.
- (void)setWeekdaySymbols:(NSArray *)array
An array of NSString objects that specify the weekday symbols for the receiver.
– weekdaySymbols– setShortWeekdaySymbols:– setVeryShortWeekdaySymbols:– setStandaloneWeekdaySymbols:– setShortStandaloneWeekdaySymbols:– setVeryShortStandaloneWeekdaySymbols:NSDateFormatter.hReturns the array of short month symbols for the receiver.
- (NSArray *)shortMonthSymbols
An array containing NSString objects representing the short month symbols for the receiver.
– setShortMonthSymbols:– monthSymbols– veryShortMonthSymbols– standaloneMonthSymbols– shortStandaloneMonthSymbols– veryShortStandaloneMonthSymbolsNSDateFormatter.hReturns the short quarter symbols for the receiver.
- (NSArray *)shortQuarterSymbols
An array containing NSString objects representing the short quarter symbols for the receiver.
– setShortQuarterSymbols:– quarterSymbols– standaloneQuarterSymbols– shortStandaloneQuarterSymbolsNSDateFormatter.hReturns the short standalone month symbols for the receiver.
- (NSArray *)shortStandaloneMonthSymbols
An array of NSString objects that specify the short standalone month symbols for the receiver.
– setShortStandaloneMonthSymbols:– monthSymbols– shortMonthSymbols– veryShortMonthSymbols– standaloneMonthSymbols– veryShortStandaloneMonthSymbolsNSDateFormatter.hReturns the short standalone quarter symbols for the receiver.
- (NSArray *)shortStandaloneQuarterSymbols
An array containing NSString objects representing the short standalone quarter symbols for the receiver.
– setShortStandaloneQuarterSymbols:– quarterSymbols– shortQuarterSymbols– standaloneQuarterSymbolsNSDateFormatter.hReturns the array of short standalone weekday symbols for the receiver.
- (NSArray *)shortStandaloneWeekdaySymbols
An array of NSString objects that specify the short standalone weekday symbols for the receiver.
– setShortStandaloneWeekdaySymbols:– weekdaySymbols– shortWeekdaySymbols– veryShortWeekdaySymbols– standaloneWeekdaySymbols– veryShortStandaloneWeekdaySymbolsNSDateFormatter.hReturns the array of short weekday symbols for the receiver.
- (NSArray *)shortWeekdaySymbols
An array of NSString objects that specify the short weekday symbols for the receiver.
– setShortWeekdaySymbols:– weekdaySymbols– veryShortWeekdaySymbols– standaloneWeekdaySymbols– shortStandaloneWeekdaySymbols– veryShortStandaloneWeekdaySymbolsNSDateFormatter.hReturns the standalone month symbols for the receiver.
- (NSArray *)standaloneMonthSymbols
An array of NSString objects that specify the standalone month symbols for the receiver.
– monthSymbols– setStandaloneMonthSymbols:– shortMonthSymbols– veryShortMonthSymbols– shortStandaloneMonthSymbols– veryShortStandaloneMonthSymbolsNSDateFormatter.hReturns the standalone quarter symbols for the receiver.
- (NSArray *)standaloneQuarterSymbols
An array containing NSString objects representing the standalone quarter symbols for the receiver.
– setStandaloneQuarterSymbols:– quarterSymbols– shortQuarterSymbols– shortStandaloneQuarterSymbolsNSDateFormatter.hReturns the array of standalone weekday symbols for the receiver.
- (NSArray *)standaloneWeekdaySymbols
An array of NSString objects that specify the standalone weekday symbols for the receiver.
– setStandaloneWeekdaySymbols:– weekdaySymbols– shortWeekdaySymbols– veryShortWeekdaySymbols– shortStandaloneWeekdaySymbols– veryShortStandaloneWeekdaySymbolsNSDateFormatter.hReturns a string representation of a given date formatted using the receiver’s current settings.
- (NSString *)stringFromDate:(NSDate *)date
The date to format.
A string representation of date formatted using the receiver’s current settings.
NSDateFormatter.hReturns the time style of the receiver.
- (NSDateFormatterStyle)timeStyle
The time style of the receiver. For possible values, see NSDateFormatterStyle.
NSDateFormatter.hReturns the time zone for the receiver.
- (NSTimeZone *)timeZone
The time zone for the receiver.
NSDateFormatter.hReturns the earliest date that can be denoted by a two-digit year specifier.
- (NSDate *)twoDigitStartDate
The earliest date that can be denoted by a two-digit year specifier.
If the two-digit start date is set to January 6, 1976, then “January 1, 76” is interpreted as New Year's Day in 2076, whereas “February 14, 76” is interpreted as Valentine's Day in 1976.
The default date is December 31, 1949.
NSDateFormatter.hReturns the very short month symbols for the receiver.
- (NSArray *)veryShortMonthSymbols
An array of NSString objects that specify the very short month symbols for the receiver.
– setVeryShortMonthSymbols:– monthSymbols– shortMonthSymbols– standaloneMonthSymbols– shortStandaloneMonthSymbols– veryShortStandaloneMonthSymbolsNSDateFormatter.hReturns the very short month symbols for the receiver.
- (NSArray *)veryShortStandaloneMonthSymbols
An array of NSString objects that specify the very short standalone month symbols for the receiver.
– setVeryShortStandaloneMonthSymbols:– monthSymbols– shortMonthSymbols– veryShortMonthSymbols– standaloneMonthSymbols– shortStandaloneMonthSymbolsNSDateFormatter.hReturns the array of very short standalone weekday symbols for the receiver.
- (NSArray *)veryShortStandaloneWeekdaySymbols
An array of NSString objects that specify the very short standalone weekday symbols for the receiver.
– setShortStandaloneWeekdaySymbols:– weekdaySymbols– shortWeekdaySymbols– veryShortWeekdaySymbols– standaloneWeekdaySymbols– shortStandaloneWeekdaySymbolsNSDateFormatter.hReturns the array of very short weekday symbols for the receiver.
- (NSArray *)veryShortWeekdaySymbols
An array of NSString objects that specify the very short weekday symbols for the receiver.
– setVeryShortWeekdaySymbols:– weekdaySymbols– shortWeekdaySymbols– standaloneWeekdaySymbols– shortStandaloneWeekdaySymbols– veryShortStandaloneWeekdaySymbolsNSDateFormatter.hReturns the array of weekday symbols for the receiver.
- (NSArray *)weekdaySymbols
An array of NSString objects that specify the weekday symbols for the receiver.
– setWeekdaySymbols:– shortWeekdaySymbols– veryShortWeekdaySymbols– standaloneWeekdaySymbols– shortStandaloneWeekdaySymbols– veryShortStandaloneWeekdaySymbolsNSDateFormatter.hThe following constants specify predefined date and time format styles.
typedef enum {
NSDateFormatterNoStyle = kCFDateFormatterNoStyle,
NSDateFormatterShortStyle = kCFDateFormatterShortStyle,
NSDateFormatterMediumStyle = kCFDateFormatterMediumStyle,
NSDateFormatterLongStyle = kCFDateFormatterLongStyle,
NSDateFormatterFullStyle = kCFDateFormatterFullStyle
} NSDateFormatterStyle;
NSDateFormatterNoStyleSpecifies no style.
Equal to kCFDateFormatterNoStyle.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterShortStyleSpecifies a short style, typically numeric only, such as “11/23/37” or “3:30pm”.
Equal to kCFDateFormatterShortStyle.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterMediumStyleSpecifies a medium style, typically with abbreviated text, such as “Nov 23, 1937”.
Equal to kCFDateFormatterMediumStyle.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterLongStyleSpecifies a long style, typically with full text, such as “November 23, 1937” or “3:30:32pm”.
Equal to kCFDateFormatterLongStyle.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterFullStyleSpecifies a full style with complete details, such as “Tuesday, April 12, 1952 AD” or “3:30:42pm PST”.
Equal to kCFDateFormatterFullStyle.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
The format for these date and time styles is not exact because they depend on the locale, user preference settings, and the operating system version. Do not use these constants if you want an exact format.
NSDateFormatter.hConstants that specify the behavior NSDateFormatter should exhibit.
typedef enum {
NSDateFormatterBehaviorDefault = 0,
NSDateFormatterBehavior10_0 = 1000,
NSDateFormatterBehavior10_4 = 1040,
} NSDateFormatterBehavior;
NSDateFormatterBehaviorDefaultSpecifies default formatting behavior.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterBehavior10_0Specifies formatting behavior equivalent to that in Mac OS X 10.0.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatterBehavior10_4Specifies formatting behavior equivalent for Mac OS X 10.4.
Available in Mac OS X v10.4 and later.
Declared in NSDateFormatter.h.
NSDateFormatter.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-11-19)