在我的應用程序中,我使用的是CoreData
。某些日期值作爲NSString
存儲在coredata中。 在我的Interface Builder
我有一個textfield.When我在我的文本字段上輸入日期此日期將比較保存在coredata中的日期。coredata中的日期比較NSPredicate
什麼是解決方案。我只是通過這種方式Example它不適用於我的項目,因爲我想在我的NSPredicate
方法上將字符串轉換爲日期。
我的代碼是
NSPredicate *p3 = [NSPredicate predicateWithFormat:@"acc_date >= %@ AND acc_date<=%@", theDate, date1];
這裏acc_date
是從數據庫日期存儲爲字符串theDate和日期1是我投入
我想比較與coredata – PSP
存儲'acc_date'作爲'NSDate'的值,以便您可以輕鬆地比較 – Akhilrajtr