ios - How to get the order of each day in a week? -
i wonder if there way know how each day of week ordered? know in gregorian calendar, property 'weekday' indicates 1-7, and
sunday represented 1. when change region(setting->general->language ®ion->region) russia, apple's calendar app displays 'm'as first day of week, while united states displays 's' first day of week. how can work out programmatically? idea, advance.
you can set programmatically start day of week following code.
to first day of week after setting
- (nsdate*)firstdayofweek { nscalendar* calender = [[nscalendar currentcalendar] copy]; [calender setfirstweekday:2]; //override locale make week start on monday nsdate* startoftheweek; nstimeinterval interval; [calender rangeofunit:nsweekcalendarunit startdate:&startoftheweek interval:&interval fordate:self]; return startoftheweek; }
to set first day of week
[[nscalendar currentcalendar] setfirstweekday:2]; //override locale make week start on monday
Comments
Post a Comment