人事部用に Lotus Notes データベースを作成しました。フィールド参加日を入力しました。フィールド「総サービス期間」も入力します。計算された使用年月日を「表示」に取得し、使用期間を毎日更新したい。
1870 次
2 に答える
0
これは、私が7 年前に Lotus Notes and Domino 4 および 5 フォーラムに投稿した式 の再投稿です。
startDate := Time1;
endDate := Time2;
startDay := @Day(startDate);
endDay := @Day(endDate);
startMonth := @Month(StartDate);
endMonth := @Month(endDate);
startYear := @Year(startDate);
endYear := @Year(endDate);
lessAYear := @If(endMonth > startMonth;@False; (endMonth = startMonth) & (endDay >= startDay); @False; @True);
yearsDiff := @If(lessAYear; endYear - startYear - 1; endYear - startYear);
@Set("endDate"; @Adjust(endDate;-yearsDiff;0;0;0;0;0));
monthAdj := @If(startDay>endDay;-1;0);
monthsDiff := @If(lessAYear; (endMonth + 12) - startMonth + monthAdj; endMonth - startMonth + monthAdj);
@Set("endDate";@Adjust(endDate;0;-monthsDiff;0;0;0;0));
daysDiff := @Integer((endDate - startDate)/86400);
@Prompt([Ok];"";@Text(yearsDiff) + "years, " + @Text(monthsDiff) + " months, and " + @Text(daysDiff) + " days.")
于 2010-09-24T10:32:55.783 に答える
0
これを完全にテストしたわけではありませんが、楽しみのために、この式を共有したかったのです。
diff:= @Adjust(endDate; -@Year(startDate); -@Month(startDate)+1;
-@Day(startDate)+1; 0; 0; 0);
y:= @Year(diff);
y:= @If(@IsError(n); 0; n>100; 0; n)
月と日も同様の方法で計算できると思います。
于 2015-09-27T23:35:51.903 に答える