To show build date, I used these code:
NSString *compileDate = [NSString stringWithUTF8String:__DATE__];
NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"MMM d yyyy"];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[df setLocale:usLocale];
NSDate *date = [df dateFromString:compileDate];
[df setDateFormat:@"yyyy"];
self.backgroundColor = [UIColor clearColor];
self.textAlignment = NSTextAlignmentCenter;
self.text = [NSString stringWithFormat:@"© Copyright 2009-%@ Version %@ %@", [df stringFromDate:[NSDate date]], VERSION, date ];
Today is 2014/03/15 and it returns 2014/03/14
My devices set up in US location. I cannot find what's wrong!
Note: The time of compile is always 20:30:00 +00:00!
How can I fix it?