Added missing DATE cast when querying for next job to run