fix accpac query to deal with time