Im using [NSDate date]
to get the current time.
Everything works fine if user don't change the time...I mean if user changed manually instead of setting it automatically.
Then how can I get the original time?
Thank you!
Silviu St
You can't find this out. The only way that goes through my mind is to take date from your server.. :(
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// display in 12HR/24HR (i.e. 11:25PM or 23:25) format according to User Settings
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString *startTime = [dateFormatter stringFromDate:startDateTime];
NSString *endTime = [dateFormatter stringFromDate:endDateTime];
NSLog(@"User's current time %@ and end Time %@ in their preference format",startTime,endTime);
来源:https://stackoverflow.com/questions/32347761/how-to-get-the-current-time-instead-of-device-time-in-ios