Re: Times in other cities
Re: Times in other cities
- Subject: Re: Times in other cities
- From: Jens Alfke <email@hidden>
- Date: Sun, 14 May 2017 18:29:22 -0700
> On May 14, 2017, at 5:47 PM, Eric Dolecki <email@hidden> wrote:
>
> I have a clock. If like to present the times in a few major cities. Say London, England. Based on the user's current time zone, present the correct hour, min, and second for London. If I can see how to do it for one city, I should be good for others.
Get an NSTimeZone instance based on a GMT offset or a name
Create an NSDateFormatter and set its timeZone property.
Use the formatter to convert [NSDate date] to a string.
If you want to display the time in some other way, like an analog clock, use NSDateComponents instead of NSDateFormatter; then you can get the hours, minutes and seconds.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden