Showing posts with label formatterBehavior. Show all posts
Showing posts with label formatterBehavior. Show all posts

Friday, May 10, 2013

NSDateFormatter formatterBehavior example ios


formatterBehavior

Returns the formatter behavior for the receiver.
- (NSDateFormatterBehavior)formatterBehavior
Return Value of [NSDateFormatter formatterBehavior]
The formatter behavior for the receiver. For possible values, seeNSDateFormatterBehavior.
Example of [NSDateFormatter formatterBehavior]
NSDateFormatter* df = [[NSDateFormatter alloc] initWithDateFormat:@"yyyyMMdd" allowNaturalLanguage:NO];
if ([df formatterBehavior] == NSDateFormatterBehavior10_0)
    NSLog(@"NSDateFormatterBehavior10_0");
else if ([df formatterBehavior] == NSDateFormatterBehavior10_4)
    NSLog(@"NSDateFormatterBehavior10_4");
Example of [NSDateFormatter formatterBehavior]
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
[df setFormatterBehavior:NSDateFormatterBehavior10_4];
[df setTimeZone:[NSTimeZone defaultTimeZone]];
[df setLocale:[NSLocale currentLocale];
NSDate *TERMIN = [NSDate alloc];
TERMIN = [df dateFromString:T]; //'T' is date in string NSLog(...,T) is 2002-05-05