开发者

How to get month & year from NSDate?

Is there any way/ method to seperate month & year form NSDate?

I just need to display current month & ye开发者_StackOverflow中文版ar? Any Example?


NSDate *date = [NSDate date];
NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:date];
NSInteger year = [dateComponents year];
NSInteger month = [dateComponents month];
[calendar release];

cheers endo


This could be done by using NSDateComponents

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜