• 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
Display either date part or time part in LOCAL format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Display either date part or time part in LOCAL format


  • Subject: Display either date part or time part in LOCAL format
  • From: Jacob Rhoden <email@hidden>
  • Date: Sun, 05 Jul 2009 17:21:57 +1000

I am probably overlooking something obvious (I hope) but what is the proper way to convert. either the Date or Time part of an NSDate to a localised string? I know I can do the following but its not exactly localised :(

NSDate *now = [[NSDate alloc] init];

NSDateFormatter *localDate = [[NSDateFormatter alloc] init];
[localDate setDateFormat:@"yyyy-MM-dd"];
NSString *date = [localDate stringFromDate:now];

NSDateFormatter *localTime = [[NSDateFormatter alloc] init];
[localTime setDateFormat:@"HH:mm:ss"];
NSString *time = [localTime stringFromDate:now];

--
____________________________________________
Jacob Rhoden          http://jacobrhoden.com

_______________________________________________

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: Display either date part or time part in LOCAL format
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: [moderator] Re: leaking UIColor objects
  • Next by Date: Re: Display either date part or time part in LOCAL format
  • Previous by thread: Re: EXC_BAD_ACCESS on returning an int?
  • Next by thread: Re: Display either date part or time part in LOCAL format
  • Index(es):
    • Date
    • Thread