Calculate dates and intervals