简体   繁体   中英

iPhone - How may I work with Monday as first day of week

I'm working with many dates. For an international work, I'd like to force (and be able to let the user decide) which is the first day of week.

But, once this is setted (let's say Minday as first day of week), I'm searching the best way to work in my code. I see that EKSunday is 1 and EKMonday is 2.

How can I convert dynamicaly Sunday to 7 and Monday to 1 ? Am I obliged to convert each return value from different method calls (when working with components for example with the weekDay return value) ? Is there any way to foce this once for all and don't have to deal with conversion ?

Why not use the existing enumeration for coding purposes and use the first-day-of-the-week preference just to display? That way, you won't have to rebuild any existing functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM