我正在构建需要最少日历的iOS应用。真的是这个月的几天。有没有人遇到过简单的源代码 - c代码很好 - 当给出一个月和一年的时候可以生成一个月的正确日期?
谢谢,
道格
答案 0 :(得分:3)
他们有以下示例显示如何从NSDate获取星期几:
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
[gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
NSInteger day = [weekdayComponents day];
NSInteger weekday = [weekdayComponents weekday];
答案 1 :(得分:0)
我发现了这个:http://www.codecogs.com/code/units/date/daysinmonth.php与谷歌。我不知道你是否能用它做点什么。可悲的是,你必须在网站上注册才能下载完整的资源......