SQL: fixed date related functions to support database's TZ