NSDate
object initialized relative the first instant of 1 January 2001, GMT by a given number of seconds. In most cases, NSDate dateWithTimeIntervalSinceReferenceDate is not preferred since you must know how many seconds relative to the GMT 2001/01/01. Example code>
[
NSDate dateWithTimeIntervalSinceReferenceDateExample qouted from Apple Developer Site]
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; |
[dateFormatter setDateFormat:@"yyyy-MM-dd 'at' HH:mm"]; |
NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:162000]; |
NSString *formattedDateString = [dateFormatter stringFromDate:date]; |
NSLog(@"formattedDateString: %@", formattedDateString); |
// For US English, the output may be: |
// formattedDateString: 2001-01-02 at 13:00 |