Added function to get time periods e.g. last week, last month