changed so database has date object
changed helper function to return seconds of date object