Added the function to get data for a time span