ios 中根据给定日期 获取星期几
来源:互联网 发布:淘宝交易量查询 编辑:程序博客网 时间:2024/04/29 18:00
- (NSUInteger)getWeekdayFromDate:(NSDate*)date
02.
03.
{
04.
05.
NSCalendar* calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
06.
07.
NSDateComponents* components = [[[NSDateComponents alloc] init] autorelease];
08.
09.
NSInteger unitFlags = NSYearCalendarUnit |
10.
11.
NSMonthCalendarUnit |
12.
13.
NSDayCalendarUnit |
14.
15.
NSWeekdayCalendarUnit |
16.
17.
NSHourCalendarUnit |
18.
19.
NSMinuteCalendarUnit |
20.
21.
NSSecondCalendarUnit;
22.
23.
24.
25.
components = [calendar components:unitFlags fromDate:date];
26.
27.
NSUInteger weekday = [components weekday];
28.
29.
return
weekday;
30.
31.
}
- (NSUInteger)getWeekdayFromDate:(NSDate*)date
02.
03.
{
04.
05.
NSCalendar* calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
06.
07.
NSDateComponents* components = [[[NSDateComponents alloc] init] autorelease];
08.
09.
NSInteger unitFlags = NSYearCalendarUnit |
10.
11.
NSMonthCalendarUnit |
12.
13.
NSDayCalendarUnit |
14.
15.
NSWeekdayCalendarUnit |
16.
17.
NSHourCalendarUnit |
18.
19.
NSMinuteCalendarUnit |
20.
21.
NSSecondCalendarUnit;
22.
23.
24.
25.
components = [calendar components:unitFlags fromDate:date];
26.
27.
NSUInteger weekday = [components weekday];
28.
29.
return
weekday;
30.
31.
}
- (NSUInteger)getWeekdayFromDate:(NSDate*)date
02.
03.
{
04.
05.
NSCalendar* calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
06.
07.
NSDateComponents* components = [[[NSDateComponents alloc] init] autorelease];
08.
09.
NSInteger unitFlags = NSYearCalendarUnit |
10.
11.
NSMonthCalendarUnit |
12.
13.
NSDayCalendarUnit |
14.
15.
NSWeekdayCalendarUnit |
16.
17.
NSHourCalendarUnit |
18.
19.
NSMinuteCalendarUnit |
20.
21.
NSSecondCalendarUnit;
22.
23.
24.
25.
components = [calendar components:unitFlags fromDate:date];
26.
27.
NSUInteger weekday = [components weekday];
28.
29.
return
weekday;
30.
31.
}
http://www.cocoachina.com/ask/questions/show/93394
0 0
- ios 中根据给定日期 获取星期几
- js获取星期,根据日期字符串获取星期几,日期获取星期,时间获取星期
- c# 根据日期 获取今天星期几
- 根据日期获取当前星期几
- PHP根据当前日期获取星期几
- php根据日期获取到时星期几
- mysql中根据某个给定日期计算那天是星期几的方法
- 根据给定日期判断当天是星期几
- 根据GregorianCalender来算给定日期是星期几
- iOS根据当前日期计算星期几
- iOS根据当前日期计算星期几
- iOS 根据时间戳获取星期几
- 根据日期显示星期几,根据日期获取当前星期几
- 给定日期输出星期几
- iOS 获取当前日期是星期几
- IOS中关于日期,星期几,以及如果更改获取的当前日期的获取问题?
- android 根据设置的日期获取星期几
- 根据指定的日期字符串获取星期几
- 【四圣龙神录的编程教室】第20章、我们来绘制背景吧
- S5PV210开发板 介绍camera 驱动 (4)
- yum [Errno 256] No more mirrors to try 解决方法
- 【Leetcode】Min Stack
- android Bound Service使用:继续Binder类绑定服务
- ios 中根据给定日期 获取星期几
- CRUD进阶
- U盘安装CENTOS6.5+WIN7双系统(win7下安装centos6.5)
- 编程珠玑11章——快速排序的改进
- linux学习之 V4L2的摄像头应用
- Java内存泄露原因详解
- 对一个简单数学问题的浮想
- 水的效果
- 微信平台接口绑定总是提示超时 解决方法