문제

I'm working on an app that can book services in later dates in many timezones. My problem is that when i'm getting timezone for one country, i got this timezone for now.

But this week-end we will change our timezone, and Paris (Actually +1) we'll become +2.

How can I get this timezone for a date like tuesday programmatically ?

도움이 되었습니까?

해결책

You can use various methods. One would be to use

- (NSInteger)secondsFromGMTForDate:(NSDate *)aDate

of NSTimeZone and get the GMT offset for a certain date and a certain timezone. Or you can use

– daylightSavingTimeOffsetForDate:

to check wether there needs a DST offset to be accounted for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top