FunDiffY.cs 704 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using IwbZero.Expr;
  3. using IwbZero.ToolCommon.StringModel;
  4. namespace IwbZero.ExprFunctions.Functions
  5. {
  6. /// <summary>
  7. /// 时间差(年)
  8. /// </summary>
  9. public class FunDiffY : IIwbFunction
  10. {
  11. public string Invoke(ExprObject poRoot)
  12. {
  13. int num = 0;
  14. var child = poRoot.GetChild(0);
  15. var child2 = poRoot.GetChild(2);
  16. if (child != null && child2 != null)
  17. {
  18. DateTime dateTime = child.Expr.StrToDt();
  19. DateTime dateTime2 = child2.Expr.StrToDt();
  20. num = dateTime.Year - dateTime2.Year;
  21. }
  22. return num.ToString();
  23. }
  24. }
  25. }