提取介于StartDate和EndDate之间的日期 [英] Fetching Dates Which Comes Between StartDate and EndDate

查看:192
本文介绍了提取介于StartDate和EndDate之间的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组日期,我只需要获取两个不同日期(StartDate和EndDate)之间的日期.

I am having array of dates and i need to fetch only those dates which comes between two differnt dates (StartDate and EndDate)..

任何人都可以帮助我解决这个问题吗? 预先感谢

can any one help me out in solving this... thanks in advance

推荐答案

假定您具有类型为NSDatestartDateendDate实例,您可以:

Assuming you have startDate and endDate instances of type NSDate you can:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF > %@) AND (SELF < %@)", startDate, endDate];
NSArray *result = [arrayWithDates filteredArrayUsingPredicate:predicate];

这篇关于提取介于StartDate和EndDate之间的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆