NSDate independent of timezone?

后端 未结 5 537
萌比男神i
萌比男神i 2020-12-17 22:45

I have an app that displays a timetable of certain ferry trips.

If I travel to a different timezone - say 4 hours behind, a 10am ferry trip now shows up as 6am?

5条回答
  •  我在风中等你
    2020-12-17 23:28

    You have seen NSDateFormatter's setTimeZone method, yes?

    http://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDateFormatter/setTimeZone:

    (b.t.w., I'd be amazed if there was a ferry that involved crossing four time zones; sounds like a cruise ship itinerary to me)

提交回复
热议问题