In my iPhone application, I somehow need the time value and get it like:
//Get the full time here
NSDate *now = [NSDate date];
//Seperate as time and date
NSArray *arr = [[[NSString alloc] initWithFormat:@"%@",now] componentsSeparatedByString:@" "];
//Get the time value
NSString *timeOnly = [arr objectAtIndex:1];
//Seperate it like hour, minute and second values
NSArray *timeOnlyArray = [timeOnly componentsSeparatedByString:@":"];
NSInteger hour = [[timeOnlyArray objectAtIndex:0] intValue];
NSInteger minute = [[timeOnlyArray objectAtIndex:1] intValue];
It all works fine except one thing: Even though my computer's and my simulator's times are set to my local time (GMT +2) the values I get while debugging on simulator are GMT time (2 hours earlier than my local).
That's fine, I can simply add 2 to my hour value but I don't know if it will be same on device. If I publish it this way, will it work same on device? Or should I add 2 hours because the application will look to GMT time in the real device too?