Revert back to longs for date in the query builder

JAVA-313 #fixes