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 *)ansiDateFormatter

Return Value

An instance of NSDateFormatter.

Discussion

Note : ANSI date format is “yyyy-MM-dd”

Declared In

ESLocaleFactory.h

ansiDatetimeFormatter

Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] , [ESLocaleFactory posixLocale] and ANSI datetime format.

+ (NSDateFormatter *)ansiDatetimeFormatter

Return Value

An instance of NSDateFormatter.

Discussion

Note : ANSI date format is “yyyy-MM-dd HH:mm:ss”

Declared In

ESLocaleFactory.h

ansiTimestampFormatter

Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] , [ESLocaleFactory posixLocale] and ANSI datetime format.

+ (NSDateFormatter *)ansiTimestampFormatter

Return 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.h

gregorianCalendar

Creates an instance of the gregorian calendar.

+ (NSCalendar *)gregorianCalendar

Return Value

NSCalendar instance

Declared In

ESLocaleFactory.h

gregorianCalendarWithLocale:

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.h

gregorianCalendarWithLocaleId:

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.h

gregorianDateFormatterWithLocale:

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.h

posixCalendar

Creates an instance of the gregorian calendar with “en_US_POSIX” locale.

+ (NSCalendar *)posixCalendar

Return Value

NSCalendar instance

Declared In

ESLocaleFactory.h

posixDateFormatter

Creates an instance of NSDateFormatter class with [ESLocaleFactory gregorianCalendar] and [ESLocaleFactory posixLocale]

+ (NSDateFormatter *)posixDateFormatter

Return Value

An instance of NSDateFormatter.

Declared In

ESLocaleFactory.h

posixLocale

Creates a locale with “en_US_POSIX” identifier.

+ (NSLocale *)posixLocale

Return Value

NSLocale instance.

Declared In

ESLocaleFactory.h

setCalendar: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