package mobvista.dmp.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by superwood
 * Product: IntelliJ IDEA
 * Date: 16/12/2
 * Time: 18:11
 * package: mobvista.dmp.util
 * function: todo
 */
public class Standardizer {

	public static  String standardizingGender(String gender){
		switch (gender) {
			case "f":
				return "female";
			case "m":
				return "male";
			default:
				return "unknown";
		}

	}

	/**
	 * Compare date int.
	 *
	 * @param dateLeft  the date left   比较的左边   yyyy-mm-dd格式
	 * @param dateRight the date right  比较的右边   yyyy-mm-dd格式
	 * @return the int    the value <code>0</code> if the argument Date is equal to
	 *          this Date; a value less than <code>0</code> if this Date
	 *          is before the Date argument; and a value greater than
	 *          <code>0</code> if this Date is after the Date argument.
	 */
	public static  int CompareDate(String dateLeft, String dateRight) throws ParseException {
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		Date dateTimeLeft = dateFormat.parse(dateLeft);
		Date dateTimeRight = dateFormat.parse(dateRight);
		return dateTimeLeft.compareTo(dateTimeRight);

	}


	/**
	 * Compare date int.
	 *
	 * @param dateLeft  the date left
	 * @param dateRight the date right
	 * @return the int  the value <code>0</code> if the argument Date is equal to
	 *          this Date; a value less than <code>0</code> if this Date
	 *          is before the Date argument; and a value greater than
	 *          <code>0</code> if this Date is after the Date argument.
	 */
	public static  int CompareDate(Date dateLeft, Date dateRight){
		int compareResult = dateLeft.compareTo(dateRight);
		return compareResult;
	}


}