NSDate(ETStringTampering) Category Reference
Declared in | ETString.h |
Overview
NSDate (ETStringTampering)
is a helper category that provides a bunch of NSString
formatting methods.
Formatting
Provided a set of pre-defined formatting methods for the most common NSDate
formatting needs.
Components extraction
Provides a set of NSDate
components extraction in an easy and straigh forward way.
Tasks
Formatting methods.
-
– formatMonthDayYear
-
– formatYYYYMMdd_HHmmss
-
– formatUtcTimestamp
-
– formatUtcDate
-
– formatAsDeltaFromNow
-
– formatAsDeltaFromNowWithTimeZoneAdjustment:
-
– formatMediumDate
-
– formatMediumDateTime
-
– formatMMDDYY
-
– formatMMDDYY:
Components extraction.
Class Methods
dayOfMonthSuffix:
Returns the day of the month suffix in english.
+ (NSString *)dayOfMonthSuffix:(int)dayOfMonth
Parameters
- dayOfMonth
The day of the month to be used as the suffix retrieving “key”.
Return Value
A NSString
object containing the pertaining suffix in English for the provided day number.
Discussion
e.g.: [NSString dayOfMonthSuffix:1];
returns st
Declared In
ETString.h
Instance Methods
dayOfMonth
Returns the day of month plus suffix for the NSDate
instance.
- (NSString *)dayOfMonth
Return Value
A NSString
containing the day of the month plus the suffix of the NSDate
instance.
Discussion
e.g: 15th
Declared In
ETString.h
dayOfWeek
Returns a NSString
day of week in English for the NSDate
instance.
- (NSString *)dayOfWeek
Discussion
e.g.: ‘Monday’ thru ‘Sunday’
Declared In
ETString.h
formatAsDeltaFromNow
Formats the NSDate
instance as a NSString
in a “human comprehensive” delta.
- (NSString *)formatAsDeltaFromNow
Return Value
A NSString
delta containing the time lapse between “now”([NSDate date]
) and the NSDate
instance.
Discussion
e.g: “22 minutes ago” or “1 day ago”
Declared In
ETString.h
formatAsDeltaFromNowWithTimeZoneAdjustment:
Formats the NSDate
instance as a NSString
in a “human comprehensive” delta with NSTimeZone
adjustment if desired.
- (NSString *)formatAsDeltaFromNowWithTimeZoneAdjustment:(BOOL)adjustTimeZone
Parameters
- adjustTimeZone
A boolean flag indicating wether or not to to
NSTimeZone
adjustment to the time lapse calculation.
Return Value
A NSString
delta containing the time lapse between “now”([NSDate date]
) and the NSDate
instance with NSTimeZone
adjustment if desired.
Discussion
e.g: “22 minutes ago” or “1 day ago”
Declared In
ETString.h
formatMMDDYY
Formats the NSDate
instance as a NSString
with the following format: @"MM/DD/YY"
.
- (NSString *)formatMMDDYY
Return Value
A NSString
object containing the NSDate
instance with the following format: @"MM/DD/YY"
.
Discussion
e.g.: 10/15/85
Declared In
ETString.h
formatMMDDYY:
Formats the NSDate
instance as a NSString
with the following format: @"MM[separator]DD[separator]YY"
with the [separator] provided.
- (NSString *)formatMMDDYY:(NSString *)separator
Parameters
- separator
The
NSString
separator character that will be used to separate theNSDate
components.e.g.: 10 [separator] 15 [separator] 85
Return Value
A NSString
object containing the NSDate
instance with the following format: @"MM[separator]DD[separator]YY"
with the [separator] provided.
Declared In
ETString.h
formatMediumDate
Formats the NSDate
instance as a NSString
with the following time style: NSDateFormatterNoStyle
and the following date style: NSDateFormatterShortStyle
.
- (NSString *)formatMediumDate
Return Value
A NSString
object containing the NSDate
instance formatted with NSDateFormatterNoStyle
time style and NSDateFormatterShortStyle
date style.
Discussion
e.g.: Oct 15, 1985
Declared In
ETString.h
formatMediumDateTime
Formats the NSDate
instance as a NSString
with the following time style: NSDateFormatterMediumStyle
and the following date style: NSDateFormatterShortStyle
.
- (NSString *)formatMediumDateTime
Return Value
A NSString
object containing the NSDate
instance formatted with NSDateFormatterMediumStyle
time style and NSDateFormatterShortStyle
date style.
Discussion
e.g.: Oct 15, 1985 09:00pm
Declared In
ETString.h
formatMonthDayYear
Formats the NSDate
instance as a NSString
using the following format: MM-DD-YYYY
.
- (NSString *)formatMonthDayYear
Return Value
A NSString
object containing the NSDate
instance formatted with the following formatter: MM-DD-YYYY
.
Declared In
ETString.h
formatUtcDate
Formats the NSDate
instance as a NSString
using the following format: @“yyyy-MM-dd” and UTC NSTimeZone
.
- (NSString *)formatUtcDate
Return Value
A NSString
object containing the NSDate
instance formatted with the following formatter: @“yyyy-MM-dd” and UTC NSTimeZone
.
Declared In
ETString.h
formatUtcTimestamp
Formats the NSDate
instance as a NSString
using the following format: @“yyyy-MM-dd HH:mm:ss” and UTC NSTimeZone
.
- (NSString *)formatUtcTimestamp
Return Value
A NSString
object containing the NSDate
instance formatted with the following formatter: @“yyyy-MM-dd HH:mm:ss” and NSTimeZone
.
Declared In
ETString.h
formatYYYYMMdd_HHmmss
Formats the NSDate
instance as a NSString
using the following format: @“yyyy-MM-dd HH:mm:ss”.
- (NSString *)formatYYYYMMdd_HHmmss
Return Value
A NSString
object containing the NSDate
instance formatted with the following formatter: @“yyyy-MM-dd HH:mm:ss”.
Declared In
ETString.h
monthOfYear
Returns a NSString
month of year for the NSDate
instance.
- (NSString *)monthOfYear
Return Value
A NSString
with the month of the year for the NSDate
instance.
Declared In
ETString.h
numberOfYearsUntilNow
Returns the amount of years from the NSDate
instance until now([NSDate date]
).
- (int)numberOfYearsUntilNow
Return Value
The amount of years from the NSDate
instance until now([NSDate date]
).
Declared In
ETString.h
timeOfDay
Returns a NSString
with the time of day with am/pm for the NSDate
.
- (NSString *)timeOfDay
Return Value
A NSString
containing the time of the day with am/pm for the NSDate
instance.
Discussion
e.g.: “9:52 am”
Declared In
ETString.h
verboseTimeOfDay
Returns a fully formatted NSString
object containing the detailed NSDate
instance in English.
- (NSString *)verboseTimeOfDay
Return Value
A fully formatted NSString
object containing the detailed NSDate
instance in English.
Discussion
e.g.: Monday, October 1st 09:35am
Declared In
ETString.h