I know you guys might be saying that this question is very common but actually I'm referring to the actual current date and time:
Let say today is 1st of August,12pm and no matter how the user change their phone date and time, I will still know today is 1st of August, 12pm...
Anyone k开发者_运维技巧now how can I do that?
You can get the real date and time from an NTP server, but this assumes that you have internet access.
If the user changes their phone date and time, then you will get that date and time... since NSDate gets its value from the iOS.
If you want it to return the actual time per time zone, you will have to set up a small Web Service
or something that returns the time for that particular time zone.
NSDate *currentDate = [NSDate date];
Now currentDate
will have the current date & time when this code is executed.
精彩评论