• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Times in other cities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Times in other cities
      • From: "Eric E. Dolecki" <email@hidden>
References: 
 >Times in other cities (From: Eric Dolecki <email@hidden>)

  • Prev by Date: Times in other cities
  • Next by Date: Re: Times in other cities
  • Previous by thread: Times in other cities
  • Next by thread: Re: Times in other cities
  • Index(es):
    • Date
    • Thread