package com.platform.test;

import java.util.Calendar;

import org.junit.Test;

import com.platform.utils.Configs;
import com.platform.utils.DateForm;
import com.platform.utils.FileOperateHelper;

public class TestWriteFile {
	
	public static void main(String[] args) {
		FileOperateHelper
		.fileWrite(
				Configs.EXTRACT_LOG_LOCALTION +"\\test.log",
				"Hello! \r\n");
		System.out.println("Hello!");
	}
	
	@Test
	public void TestCalendar(){
		Calendar c2 = Calendar.getInstance();
		 String time = DateForm.date2StringByDay(c2.getTime());
		 System.out.println(time);
		System.out.println("----"+c2.get(Calendar.MONTH));
		c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
		 time = DateForm.date2StringByDay(c2.getTime());
		 System.out.println(time);
		 System.out.println("----"+c2.get(Calendar.MONTH));
	}
	
	private int getMonBeforeHalfYear(int num){
		num -= 6;
		if (num <= 0) {
			num = num + 12;
		}
		return num;
	}

}
