• 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
converting between strings, NSCalendarDates and back again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

converting between strings, NSCalendarDates and back again


  • Subject: converting between strings, NSCalendarDates and back again
  • From: John Clayton <email@hidden>
  • Date: Wed, 17 Mar 2004 22:23:18 -0500

Hi,

Say I have a date coming in as input to a framework method that looks like this:Thu Oct 16 11:38:11 2003

I know that the date is in the GMT timezone. I need to convert the string to an NSCalendarDate (I think) and be able to return it in the same format. I've tried doing this to get the date initialized:
NSString *dateStringForGMT = [myDateString stringByAppendingString:@" GMT"];
NSCalendarDate *newDate = [NSCalendarDate dateWithString:dateStringForGMT calendarFormat:@"%a %b %d %H:%M:%S %Y %Z"];

which seems to work fine when creating the date. But is there some magic to getting it to return the original string format when calling -description but still retaining its proper time?

Thanks, J.


-----------------------------------------------------------------------
"It is the truth that frees, not your attempts to be free."
- J. Krishnamurti
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: converting between strings, NSCalendarDates and back again
      • From: Jonathan Jackel <email@hidden>
  • Prev by Date: Re: Cocoa equivelant of NMInstall()?
  • Next by Date: Re: Cocoa equivelant of NMInstall()?
  • Previous by thread: Re: Cocoa Documentation Updates
  • Next by thread: Re: converting between strings, NSCalendarDates and back again
  • Index(es):
    • Date
    • Thread