NSDate(Extensions) Category Reference

Declared in NSDate+Extensions.h

Overview

NSDate extensions.

– timesince

Returns a string describing in natural language the time since this NSDate. Can be localized if localization tables are provided. See above for examples.

- (nonnull NSString *)timesince

Return Value

A string describing in natural language the time since this NSDate.

Declared In

NSDate+Extensions.h

– timesinceWithDepth:

Returns a string describing in natural language the time since this NSDate using the given RBTimesinceDepth.

- (nonnull NSString *)timesinceWithDepth:(RBTimesinceDepth)depth

Parameters

depth

The depth to describe the time span to.

Return Value

A string describing in natural language the time since this NSDate.

Declared In

NSDate+Extensions.h

– timesinceDate:withDepth:

Returns a string describing in natural language the time span from this NSDate since the NSDate given, to the given RBTimesinceDepth.

- (nonnull NSString *)timesinceDate:(nonnull NSDate *)date withDepth:(RBTimesinceDepth)depth

Parameters

date

The date to calculate the timespan from this NSDate to.

depth

The depth to describe the time span to.

Return Value

A string describing in natural language the time since this NSDate.

Declared In

NSDate+Extensions.h

+ timesinceWithTimeInterval:depth:

Returns the string describing in natural language the time span given.

+ (nonnull NSString *)timesinceWithTimeInterval:(NSTimeInterval)timeInterval depth:(RBTimesinceDepth)depth

Parameters

timeInterval

The time span to describe.

depth

The depth to describe the time span to.

Return Value

A string describing the time span in natural language.

Declared In

NSDate+Extensions.h

– beginningOfDay

Calculates the beginning of the day of this NSDate.

- (nonnull NSDate *)beginningOfDay

Return Value

A new NSDate at the beginning of the day of this NSDate.

Declared In

NSDate+Extensions.h

– isToday

Whether this NSDate is today.

- (BOOL)isToday

Return Value

true if it is today, false if not.

Declared In

NSDate+Extensions.h

+ todayAtHour:minute:second:

Creates an NSDate for today at the given time.

+ (nonnull NSDate *)todayAtHour:(int)hour minute:(int)minute second:(int)second

Parameters

hour

The hour of the day.

minute

The minute of the hour.

second

The second of the minute.

Return Value

The NSDate object.

Declared In

NSDate+Extensions.h

+ date:atHour:minute:second:

Creates an NSDate for the given date at the given time.

+ (nonnull NSDate *)date:(nonnull NSDate *)date atHour:(int)hour minute:(int)minute second:(int)second

Parameters

date

The calendar date to apply the time components to.

hour

The hour of the day.

minute

The minute of the hour.

second

The second of the minute.

Return Value

The NSDate object.

Declared In

NSDate+Extensions.h

+ dateWithZeroTime:

Creates an NSDate for the given date at the beginning of the day.

+ (nonnull NSDate *)dateWithZeroTime:(nonnull NSDate *)date

Parameters

date

The calendar date.

Return Value

The NSDate object.

Declared In

NSDate+Extensions.h

+ todayAtInterval:

Creates an NSDate for today plus the given NSTimeInterval.

+ (nonnull NSDate *)todayAtInterval:(NSTimeInterval)interval

Parameters

interval

The NSTimeInterval from the beginning of the day.

Return Value

The NSDate object.

Declared In

NSDate+Extensions.h

+ dateTimeFromDate:time:

Creates an NSDate for the given date at the given time.

+ (nonnull NSDate *)dateTimeFromDate:(nonnull NSDate *)date time:(nonnull NSDate *)time

Parameters

date

The calendar date to use.

time

The time of the day to use.

Return Value

The NSDate object.

Declared In

NSDate+Extensions.h

– dateAtTimeIntervalFromStartOfDay:

Gets the date at the given interval from the start of the day.

- (nonnull NSDate *)dateAtTimeIntervalFromStartOfDay:(NSTimeInterval)timeIntervalFromStartOfDay

Parameters

timeIntervalFromStartOfDay

The time interval since the start of the day.

Return Value

The new NSDate object.

Declared In

NSDate+Extensions.h

– timeIntervalFromStartOfDay

Gets the NSTimeInterval from the start of the day.

- (NSTimeInterval)timeIntervalFromStartOfDay

Return Value

The interval from the start of the day.

Declared In

NSDate+Extensions.h