ESLocaleFactory Class Reference
| Inherits from | NSObject |
| Declared in | ESLocaleFactory.h ESLocaleFactory.m |
Overview
A collection of factory methods that construct properly configured instances of NSDateFormatter, NSLocale and NSCalendar classes.
Class Methods
ansiDateFormatter
Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] , [ESLocaleFactory posixLocale] and ANSI date format.
+ (NSDateFormatter *)ansiDateFormatterReturn Value
An instance of NSDateFormatter.
Discussion
Note : ANSI date format is “yyyy-MM-dd”
Declared In
ESLocaleFactory.hansiDatetimeFormatter
Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] , [ESLocaleFactory posixLocale] and ANSI datetime format.
+ (NSDateFormatter *)ansiDatetimeFormatterReturn Value
An instance of NSDateFormatter.
Discussion
Note : ANSI date format is “yyyy-MM-dd HH:mm:ss”
Declared In
ESLocaleFactory.hansiTimestampFormatter
Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] , [ESLocaleFactory posixLocale] and ANSI datetime format.
+ (NSDateFormatter *)ansiTimestampFormatterReturn Value
An instance of NSDateFormatter.
Discussion
Additionally to [ESLocaleFactory ansiDatetimeFormatter] it includes ticks.
Note : ANSI date format is “yyyy-MM-dd HH:mm:ss.SSS”
Declared In
ESLocaleFactory.hgregorianCalendar
Creates an instance of the gregorian calendar.
+ (NSCalendar *)gregorianCalendarReturn Value
NSCalendar instance
Declared In
ESLocaleFactory.hgregorianCalendarWithLocale:
Creates a gregorian calendar and sets the corresponding locale.
+ (NSCalendar *)gregorianCalendarWithLocale:(NSLocale *)locale_Parameters
- locale_
An instance of NSLocale class to set for the newly created NSCalendar object.
Return Value
An instance of NSCalendar.
Declared In
ESLocaleFactory.hgregorianCalendarWithLocaleId:
Creates a gregorian calendar and sets the locale with a corresponding identifier.
+ (NSCalendar *)gregorianCalendarWithLocaleId:(NSString *)localeIdentifier_Parameters
- localeIdentifier_
A string that will be passed to the [NSLocale initWithLocaleIdentifier:] constructor (designated initializer).
Return Value
An instance of NSCalendar.
Declared In
ESLocaleFactory.hgregorianDateFormatterWithLocale:
Creates a properly configured instance of NSDateFormatter object with the gregorian calendar and a given NSLocale object.
+ (NSDateFormatter *)gregorianDateFormatterWithLocale:(NSLocale *)locale_Parameters
- locale_
An instance of NSLocale class to set for the newly created NSCalendar object.
Return Value
An instance of NSDateFormatter.
Declared In
ESLocaleFactory.hposixCalendar
Creates an instance of the gregorian calendar with “en_US_POSIX” locale.
+ (NSCalendar *)posixCalendarReturn Value
NSCalendar instance
Declared In
ESLocaleFactory.hposixDateFormatter
Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] and [ESLocaleFactory posixLocale]
+ (NSDateFormatter *)posixDateFormatterReturn Value
An instance of NSDateFormatter.
Declared In
ESLocaleFactory.hposixLocale
Creates a locale with “en_US_POSIX” identifier.
+ (NSLocale *)posixLocaleReturn Value
NSLocale instance.
Declared In
ESLocaleFactory.hsetCalendar:forDateFormatter:
Synchronizes the locale of the given calendar and date formatter. The NSCalendar object and its corresponding NSLocale object will be assigned to the properties of the NSDateFormatter instance.
+ (void)setCalendar:(NSCalendar *)calendar_ forDateFormatter:(NSDateFormatter *)result_Parameters
- calendar_
A calendar that will be assigned to the date formatter. Its locale will be assigned to the date formatter.
- result_
A date formatter to configure.
NSLocale locale = [ ESLocaleFactory posixLocale ]; NSCalendar calendar = [ ESLocaleFactory gregorianCalendar ]; calendar.locale = locale;
NSDateFormatter* dateFormatter = [ NSDateFormatter new ];
[ ESLocaleFactory setCalendar: calendar forDateFormatter: dateFormatter ];
Declared In
ESLocaleFactory.h