add helper function to get record by dates