NSDate returns the current date. Although it can convert to and from string format in different locales / time zones, NSDate does not have an internal time zone concept. NSDates are not tied to any particular area. If you and anyone else in the world asked for your devices on [NSDate date] at the same time, you will get equal results - not because it always returns to GMT, but because it does not return in hourly mode. In Cocoa, the date is a specific moment in the history of the Earth. How you write the date is related to your calendar, your time zone and your language.
You do not receive the date tomorrow, you receive the correct date, and then notice that it gives another day if it is expressed in GMT. This is the correct date, just written differently than you would like.
'description' is a method overridden from NSObject. When you are an NSLog object, what happens inside is that the description method is called and a string is returned. Thus, you should get the same results when registering object and [object description] , since previous calls describe and print this line, the latter calls the description, then calls the description in the received line and prints it. NSStrings are returned as a result of the description.
This should be the default behavior, but to get a meaningful description, try:
NSLog(@"%@", [[NSDate date] descriptionWithCalendarFormat:nil timeZone:[NSTimeZone localTimeZone] locale:[NSLocale currentLocale]]);
If it still registers in GMT, your device considers itself GMT. I have no idea how reliable the simulator is in this regard.
Tommy
source share