Take the 2-minute tour ×

I'm writing an app that needs to display and calculate all dates, times, timeintervals etc. from a specific, given timezone in Europe. Meaning, if I'm, say, in Paris, the app works flawlessly now, but if I go to New York, the app should display and work exactly as if I were still in Paris.

Naively, I tried (in the application: didFinishLaunchingWithOptions: function)

[[NSCalendar currentCalendar] setTimeZone:[NSTimeZone timeZoneWithName:@"Europe/Paris"]];

but of course that doesn't work, all my NSDateFormatter objects still use the current timezone if not explicitly told otherwise.

So, what I'd like to know is:

  • Is there any way to globally enforce a timezone in an app? I'd rather not go through all my code and fix every single date formatter and date picker and so on if there's another way.

  • Will [NSTimeZone timeZoneWithName:@"Europe/Paris"] properly switch between CET and CEST?

Thanks ahead!

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

You can use the method + (void)setDefaultTimeZone:(NSTimeZone *)aTimeZone of the class NSTimeZone.

share|improve this answer
... alright, now I feel stupid :-) I accepted your answer, but could you maybe just add what you think about the CET/CEST issue? Thanks very much! –  JiaYow Feb 21 '12 at 16:14
Yes, I think it does switch automatically by default. –  sch Feb 21 '12 at 16:37
Perfect, thank you. Upvoted your answer :-) –  JiaYow Feb 22 '12 at 13:19
add comment

Your Answer


