Fixed the query issue and added time functions

Added 3 functions and a class by wuchris to fix the time strings and
made the queries work