Refactor date/time handling in the SQL translator.