验证年龄大于18,从今天的日期算起
问题描述:
我有一个莲花应用程序,其中包含一个领域,员工必须输入他们的出生日期......我想验证员工年龄应该大于18岁计算从当前日期.. 我该怎么做?验证年龄大于18,从今天的日期算起
我做
diff :[email protected](@Today)[email protected](@ThisValue);
@If(@ThisValue = ""; @Return("Please enter 'Date of Birth'."); @ThisValue != "" & @Date(@ThisValue) > @Date(@Today); @Return("'Date of Birth' should not be greater than 'Today Date'."); diff <18; @Return("'Age' cannot be less than 18yrs."); @Success)
但这仅计算当年....我怎么做计算当前的日期?
答
使用功能@Adjust(dateToAdjust ; years ; months ; days ; hours ; minutes ; seconds ; [DST])
@Adjust(@Now;-18;0;0;0;0;0)
并将其与员工的生日