--

NSDateFormatter is your friend.  =)

You use it like this:
NSDateFormatter * f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"YYYY-mm-dd"];
NSLog([f stringFromDate:aDate]);
[f release];

There's also a really handy "dateFromString" method that will parse a
string according to the format string you specify.

This page has lots of good info on what the formatting specifiers are:
http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns

HTH,

Dave

--

@Dave DeLong

Sorry, didn't get your previous message.  I think something may be wrong
with my email account. ;)  In any event, here is my current code:

NSCalendarDate *date = [NSCalendarDate calendarDate];
NSString *dateString = [date descriptionWithCalendarFormat:@"%Y-%m%d"];

Now I am wondering how I can take that special formatted string and save it
back into NSCalendarDate or NSDate (knowing how it was formatted).  I looked
up some information regarding dateFromString but it returns null when I pass
it my string.  Though I could be doing something wrong regarding
dateFromString.


Thanks for any help.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to