Getting weekday name from weekday number?
Getting weekday name from weekday number?
- Subject: Getting weekday name from weekday number?
- From: Rick Mann <email@hidden>
- Date: Tue, 18 Oct 2011 15:18:58 -0700
Hi. Given a day-of-week number, what's the best way to get the abbreviated name of that weekday? I've tried using NSDateComponents in various ways (stand-alone, building off the current date, etc.) to get at it (by using NSDateFormatter on the resulting date), but none seem to work. Basically, setting the weekday on NSDateComponents seems to do nothing.
Matters are complicated by the fact that two of the three format specifiers for weekday name use the "local" weekday number, which can vary by locale.
Any suggestions? I could just roll my own and localize it, but I'd rather just use what the OS provides.
The only other thing I can think to do is start with a known date for, say, Sunday, and add to that the weekday number I have, and the convert that date to a string formatted as a weekday name.
Thanks,
--
Rick
_______________________________________________
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