date query now functioning