changed helper function to return seconds of date object