using System; using IwbZero.Expr; using IwbZero.ToolCommon.StringModel; namespace IwbZero.ExprFunctions.Functions { /// /// 获取日期(年-01-01) /// public class FunGetFdy:IIwbFunction { public string Invoke(ExprObject exprObj) { DateTime dateTime = DateTime.Now; int num = dateTime.Year; ExprObject child = exprObj.GetChild(0); if (child != null) { ExprTypes exprTypes = EvalExpr.GetExprTypes(child); if (exprTypes == ExprTypes.Integer || exprTypes == ExprTypes.Decimal) { num = child.Expr.ValI(); } else { dateTime = child.Expr.StrToDt(); num = dateTime.Year; } } return $"{num}-01-01"; } } }