My local and default time zone is GMT +5 but when I get date and time by NSDate it return me GMT date and time.
For example the code and output from my code while
This works well for me to get the date in my timezone and format it just like I want it:
NSDate* gmtDate = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"America/Los_Angeles"]];
[formatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"];
NSString *dateString = [formatter stringFromDate:gmtDate];