package com.changhong.epc.count.service.system.func.set.date;
|
|
import com.changhong.epc.count.service.system.func.set.AbsFuncSupper;
|
import com.changhong.epc.count.service.tool.SystemFunTool;
|
import com.googlecode.aviator.runtime.type.AviatorObject;
|
import com.iemsoft.framework.cloud.core.tools.DateTool;
|
|
import java.util.Calendar;
|
import java.util.Map;
|
|
/**
|
* 获取时间函数 年
|
* @author wangZX
|
*
|
*/
|
public class GetYearFuntion extends AbsFuncSupper {
|
|
@Override
|
public AviatorObject call(Map<String, Object> env, AviatorObject arg1) {
|
|
String date = SystemFunTool.getStringVal(arg1, env);
|
|
try{
|
Calendar c = Calendar.getInstance();
|
c.setTime(DateTool.stringToDate(date));
|
c.get(Calendar.YEAR);
|
return getAviatorLong( new Long(c.get(Calendar.YEAR)) );
|
}catch(Exception e){
|
return getAviatorLong(0);
|
}
|
}
|
|
@Override
|
public String getName() {
|
return FUNC_DATE_GET_YEAR;
|
}
|
|
}
|