Refactored datetime routines, added timezone support.