2011-12-09 129 views
1

我有一個蓮花應用程序,其中包含一個領域,員工必須輸入他們的出生日期......我想驗證員工年齡應該大於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) 

但這僅計算當年....我怎麼做計算當前的日期?

回答

2

使用功能@Adjust(dateToAdjust ; years ; months ; days ; hours ; minutes ; seconds ; [DST])

@Adjust(@Now;-18;0;0;0;0;0) 

並將其與員工的生日