Add date query function.