我正在尝试根据所选的月份和年份查看查询:
我已经选择了所声明的日期(// dateselectedStr =" 2016-11" )
并且在线数据库中的存储日期包含updatedAt相同的2016-11,如何根据有.contain搜索查询?这是我的踪迹
query.order(byDescending: "updatedAt")
if PFUser.current() != nil {
query.whereKey(CARD_UPDATED_AT, contains: dateselectedStr)
query.findObjectsInBackground { (objects, error)-> Void in
if error == nil {
self.recipesArray = objects!
// Reload CollView
self.recipesCollView.reloadData()
let counter = (objects!.count)
print(counter)
self.title = "\(counter) JOB CARDS"
self.hideHUD()
// Hide/show the nothing found Label
if self.recipesArray.count == 0 { self.nothingFoundLabel.isHidden = false
} else { self.nothingFoundLabel.isHidden = true }
} else {
self.simpleAlert("\(error!.localizedDescription)")
self.hideHUD()
}}
答案 0 :(得分:0)
AFAIK,这是唯一可行的解决方案
2016年,
updatedAt> = 01-01-2016& updatedAt< = 31-12-2016
1月份,
updateAt> = 01-01-2016& updatedAt< = 31-01-2016
希望这会有所帮助:)