package com.smppw.common.rollrange.date.item;

import java.util.Calendar;

/**
 * @author Yu Liu
 *
 */
public class Month extends BaseDateTime {
	
	@Override
	public int between(Calendar startDate, Calendar endDate) {
		int years = endDate.get(Calendar.YEAR) - startDate.get(Calendar.YEAR);
		return years * 12 + (endDate.get(Calendar.MONTH) - startDate.get(Calendar.MONTH));
	}

	@Override
	public Calendar shift(Calendar date, int offside) {
		date.add(Calendar.MONTH, offside);
		return date;
	}

	@Override
	public Calendar startDayOfPeriod(Calendar date) {
		date.set(Calendar.DAY_OF_MONTH, 1);
		return date;
	}

}
