Tutorial by Examples

The NSDate class provides methods for creating NSDate objects corresponding to a given date and time. An NSDate can be initialized using the designated initializer, which: Returns an NSDate object initialized relative to 00:00:00 UTC on 1 January 2001 by a given number of seconds. NSDate *date...
There are 4 methods for comparing NSDates in Objective-C: - (BOOL)isEqualToDate:(NSDate *)anotherDate - (NSDate *)earlierDate:(NSDate *)anotherDate - (NSDate *)laterDate:(NSDate *)anotherDate - (NSComparisonResult)compare:(NSDate *)anotherDate Consider the following example using 2 dates, N...
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 The downside for this situation is that your NSDate is almost completely "naked" and what you need to do is to create: day, month, year, second and time zone in order to this object to &quo...
If ww have NSDate object, and we want to convert it into NSString. There are different types of Date strings. How we can do that?, It is very simple. Just 3 steps. Create NSDateFormatter Object NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; Set the date format in whi...

Page 1 of 1