| 12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using IwbZero.Expr;
- using IwbZero.ToolCommon.StringModel;
- namespace IwbZero.ExprFunctions.Functions
- {
- /// <summary>
- /// 获取日期(年-01-01)
- /// </summary>
- 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";
- }
- }
- }
|