![](/img/trans.png)
[英]Ho to get month/weekday symbols from NSDateFormatter in current language (iPhone)
[英]Get the weekday from a selected day and not from the current day
我见过很多方法来获得工作日,但没有一个是来自选定的一天。
NSDate * selectedDate = _selectedDate //From Params
NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents *components = [cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[[NSDate alloc] init]];
NSInteger weekday = [components weekday];
我应该如何以及在哪里插入我选择的日期?
由于 [components setDay:(INTEGER REQUIRED)] 是一种将所选日期转换为当前日期的方法..有人对此有所了解吗?
谢谢
你有没有尝试过?
NSDateComponents *components = [cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:selectedDate];
NSDateComponents *components =
[cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit
fromDate:selectedDate];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.