#include int main (void) { NSAutoreleasePool *pool; pool = [NSAutoreleasePool new]; NSDate* d = [NSDate date]; NSLog(@"the date as date object %@", d); NSDateFormatter* format = [[NSDateFormatter alloc] init]; NSLog(@"Dateformatter defaults"); NSLog(@" DateFormatter timezone: %@", [format timeZone]); NSLog(@" DateFormatter locale: %@", [format locale]); NSLog(@" DateFormatter datestyle: %u", [format dateStyle]); NSLog(@" DateFormatter timestyle: %u", [format timeStyle]); NSLog(@" Date formatted with defaults %@", [format stringFromDate: d]); NSLocale *loc = [[NSLocale alloc] initWithLocaleIdentifier: @"nl_BE"]; [format setLocale: loc]; [format setDateStyle: NSDateFormatterNoStyle]; [format setTimeStyle: NSDateFormatterMediumStyle]; NSLog(@"DateFormatter: Date -> NoStyle, Time -> MediumStyle"); NSLog(@" DateFormatter timezone: %@", [format timeZone]); NSLog(@" DateFormatter locale: %@", [format locale]); NSLog(@" DateFormatter datestyle: %u", [format dateStyle]); NSLog(@" DateFormatter timestyle: %u", [format timeStyle]); NSLog(@" Date formatted with style %@", [format stringFromDate: d]); [format setDateStyle: NSDateFormatterLongStyle]; [format setTimeStyle: NSDateFormatterLongStyle]; NSLog(@"DateFormatter: Date -> LongStyle, Time -> LongStyle"); NSLog(@" DateFormatter timezone: %@", [format timeZone]); NSLog(@" DateFormatter locale: %@", [format locale]); NSLog(@" DateFormatter datestyle: %u", [format dateStyle]); NSLog(@" DateFormatter timestyle: %u", [format timeStyle]); NSLog(@" Date formatted with style %@", [format stringFromDate: d]); RELEASE(format); RELEASE(loc); RELEASE(pool); return 0; }