create monthSeg function