Reputation: 2930
I'm working on setting up NSDateFormatter to explain the date, and I'd like something short but more intuitive than 15/07/10. I think I've seen some formats that will say simply "Today" or "Tomorrow" or the day of the week for subsequent days of the same week. Is there a simple apple-approved way to get this type of date?
Thanks.
Upvotes: 6
Views: 1704
Reputation: 28242
If you're targeting iOS 4 or later, you can call [yourFormatter setDoesRelativeDateFormatting:YES]
. Otherwise, you'll most likely need a custom subclass. As for days of the week, what jer said.
Upvotes: 12
Reputation: 20236
Ensure you set up your locale with the NSDateFormatter appropriately, and then ask for the weekdaySymbols
. This will return an array with the days of the week in the locale you specify.
Upvotes: 1