Moved time zone adjustment to sql queries

Moved the adjustment of the date time to UTC time to the SQL query where
it is needed instead of further up the call stack.