Declared in NSDate+TKCategory.h
NSDate+TKCategory.m

Overview

Additional functionality for NSDate.

Properties

monthDate

Creates and returns a new date set to the first day of the month from the date object.

@property (nonatomic, readonly, copy) NSDate *monthDate

Return Value

A NSDate object set to the same month as the date object. The day will be the first of the month.

Declared In

NSDate+TKCategory.h

monthString

Returns a NSString with the localized month string for the NSDate object.

@property (nonatomic, readonly, copy) NSString *monthString

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h

monthYearString

Returns a NSString with the localized month and year string for the NSDate object.

@property (nonatomic, readonly, copy) NSString *monthYearString

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h

today

Returns a Boolean value that indicates whether the date object is that same date information as the current day.

@property (nonatomic, getter=isToday, readonly) BOOL today

Return Value

YES if the date object represents the current date, otherwise NO.

Declared In

NSDate+TKCategory.h

tomorrow

Returns a Boolean value that indicates whether the date object is that same date information as tomorrow.

@property (nonatomic, getter=isTomorrow, readonly) BOOL tomorrow

Return Value

YES if the date object represents tomorrow’s date, otherwise NO.

Declared In

NSDate+TKCategory.h

yearString

Returns a NSString with the localized year string for the NSDate object.

@property (nonatomic, readonly, copy) NSString *yearString

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h

yesterday

Returns a Boolean value that indicates whether the date object is that same date information as yesterday.

@property (nonatomic, getter=isYesterday, readonly) BOOL yesterday

Return Value

YES if the date object represents yesterday’s date, otherwise NO.

Declared In

NSDate+TKCategory.h

Class Methods

dateWithDateComponents:

Returns a NSDate from the given component information for the gregorian calendar.

+ (NSDate *)dateWithDateComponents:(NSDateComponents *)components

Parameters

components

The information used to create the date.

Return Value

A NSDate object.

Declared In

NSDate+TKCategory.h

month

Creates and returns a new date set to the current month date.

+ (NSDate *)month

Return Value

A NSDate object set to the current month.

Declared In

NSDate+TKCategory.h

monthWithTimeZone:

Creates and returns a new date set to the current month date. Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.

+ (NSDate *)monthWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to repect.

Return Value

A NSDate object set to the current month.

Declared In

NSDate+TKCategory.h

tomorrow

Creates and returns a new date set to tomorrow’s day and current time.

+ (NSDate *)tomorrow

Return Value

A NSDate object set to tomorrow.

Declared In

NSDate+TKCategory.h

tomorrowWithTimeZone:

Creates and returns a new date set to the tomorrow’s day and current time. Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.

+ (NSDate *)tomorrowWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to repect.

Return Value

A NSDate object set to tomorrow.

Declared In

NSDate+TKCategory.h

yesterday

Creates and returns a new date set to the previous day and current time.

+ (NSDate *)yesterday

Return Value

A NSDate object set to yesterday.

Declared In

NSDate+TKCategory.h

yesterdayWithTimeZone:

Creates and returns a new date set to the previous day and current time. Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.

+ (NSDate *)yesterdayWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to repect.

Return Value

A NSDate object set to yesterday.

Declared In

NSDate+TKCategory.h

Instance Methods

dateComponentsWithTimeZone:

Returns an NSDateComponents object from the NSDate object with respect to the given time zone and gregorian calendar.

- (NSDateComponents *)dateComponentsWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

A NSDateComponents object.

Declared In

NSDate+TKCategory.h

isSameDay:

Returns whether the compared date shares the date with respect to the default time zone.

- (BOOL)isSameDay:(NSDate *)anotherDate

Parameters

anotherDate

The date to compare.

Return Value

YES if the two dates share the same year, month and day. Otherwise NO.

Declared In

NSDate+TKCategory.h

isSameDay:timeZone:

Returns whether the compared date shares the date with respect to the given time zone.

- (BOOL)isSameDay:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone

Parameters

anotherDate

The date to compare.

timeZone

The time zone used to determine the current day.

Return Value

YES if the two dates share the same year, month and day. Otherwise NO.

Declared In

NSDate+TKCategory.h

isSameMonth:

Returns whether the compared date shares the month with respect to the given time zone.

- (BOOL)isSameMonth:(NSDate *)anotherDate

Parameters

anotherDate

The date to compare.

Return Value

YES if the two dates share the same year, month. Otherwise NO.

Declared In

NSDate+TKCategory.h

isSameMonth:timeZone:

Returns whether the compared date shares the month with respect to the given time zone.

- (BOOL)isSameMonth:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone

Parameters

anotherDate

The date to compare.

timeZone

The time zone used to determine the current day.

Return Value

YES if the two dates share the same year, month. Otherwise NO.

Declared In

NSDate+TKCategory.h

isSameYear:

Returns whether the compared date shares the year with respect to the given time zone.

- (BOOL)isSameYear:(NSDate *)anotherDate

Parameters

anotherDate

The date to compare.

Return Value

YES if the two dates share the same year. Otherwise NO.

Declared In

NSDate+TKCategory.h

isSameYear:timeZone:

Returns whether the compared date shares the year with respect to the given time zone.

- (BOOL)isSameYear:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone

Parameters

anotherDate

The date to compare.

timeZone

The time zone used to determine the current day.

Return Value

YES if the two dates share the same year. Otherwise NO.

Declared In

NSDate+TKCategory.h

isTodayWithTimeZone:

Returns a Boolean value that indicates whether the date object is that same date information as the current day.

- (BOOL)isTodayWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

YES if the date object represents the current date, otherwise NO.

Declared In

NSDate+TKCategory.h

isTomorrowWithTimeZone:

Returns a Boolean value that indicates whether the date object is that same date information as tomorrow.

- (BOOL)isTomorrowWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

YES if the date object represents tomorrow’s date, otherwise NO.

Declared In

NSDate+TKCategory.h

isYesterdayWithTimeZone:

Returns a Boolean value that indicates whether the date object is that same date information as yesterday.

- (BOOL)isYesterdayWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

YES if the date object represents yesterday’s date, otherwise NO.

Declared In

NSDate+TKCategory.h

monthDateWithTimeZone:

Creates and returns a new date set to the first day of the month from the date object. Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.

- (NSDate *)monthDateWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

Time Zone for month.

Return Value

A NSDate object set to the same month as the date object. The day will be the first of the month.

Declared In

NSDate+TKCategory.h

monthStringWithTimeZone:

Returns a NSString with the localized month string for the NSDate object.

- (NSString *)monthStringWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h

monthYearStringWithTimeZone:

Returns a NSString with the localized month and year string for the NSDate object.

- (NSString *)monthYearStringWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h

monthsBetweenDate:

Returns number of months between two dates.

- (NSInteger)monthsBetweenDate:(NSDate *)date

Parameters

date

The other date to compare.

Return Value

Returns number of months between two dates.

Declared In

NSDate+TKCategory.h

monthsBetweenDate:timeZone:

Returns number of months between two dates.

- (NSInteger)monthsBetweenDate:(NSDate *)toDate timeZone:(NSTimeZone *)timeZone

Parameters

toDate

The other date to compare.

timeZone

The time zone to respect.

Return Value

Returns number of months between two dates.

Declared In

NSDate+TKCategory.h

yearStringWithTimeZone:

Returns a NSString with the localized year string for the NSDate object.

- (NSString *)yearStringWithTimeZone:(NSTimeZone *)timeZone

Parameters

timeZone

The time zone to respect.

Return Value

An NSString object.

Declared In

NSDate+TKCategory.h