1

What is the predicate equivalent of SQL query

DATETIME('now','+0 seconds’) > DATETIME(ZDATE,TIME(ZEND_TIME))

where

ZDATE is date in format YYYY-MM-DD HH:mm:ss
ZEND_TIME is date in format YYYY-MM-DD HH:mm:ss

I am getting the following error when I am directly using it in NSPredicate

Unable to parse function name 'DATETIME' into supported selector (DATETIME)
SandeepAggarwal
  • 1,273
  • 3
  • 14
  • 38
  • For people who don't speak SQL, what exactly are you trying to fetch? Are the `ZDate` and `ZEND_TIME` stored as `NSDate`? My guess, is that you want something like that: `[NSPredicate predicateWithFormat:@"myDateKey > %@ AND myDateKey > %@ and myDateKey < %@", [NSDate date], ZDATE, ZEND_TIME];` Not that it will work, but I suggest you decompose in a more classical "if" test. – Larme Jul 25 '15 at 12:08

0 Answers0