domino lotus公式计算日期

计算一个月天数FIELD currentYear:=@Year(@Now);
FIELD currentMonth:=@Month(@Now);

CurrentMonthFirstDate:=@Date(currentYear;currentMonth;1);
NextMonthFirstDate:=@Adjust(CurrentMonthFirstDate;0;1;0;0;0;0);
FIELD TotalDays:=(NextMonthFirstDate-CurrentMonthFirstDate)/86400;
TotalDays

本周开始日期
a:=@Weekday(@Today);
AdjustNum:=@If(a!=1;2-a;-6);
@Adjust(@Today;0;0;AdjustNum;0;0;0)

本周结束日期
a:=@Weekday(@Today);
AdjustNum:=@If(a!=1;7-a+1;0);
@Adjust(@Today;0;0;AdjustNum;0;0;0)

其它时间只需要修改@Today部分即可

@Weekday这个公式得到这一天的星期几,@Adjust这个可以帮你算出相关这一天的周一和周末

本天为全年的第几周
@Integer(@If(3;1;0)+@BusinessDays”>7-@Weekday(@Date(@Year(@Now);1;1))>3;1;0)+@BusinessDays(

@Date(@Year(@Now);1;1);@Date(@Now) )/7)

计算下周是第多少周的
yearnumber:=@Year(@Today);
newyear:=@Date(yearnumber;1;1);
weeknewyear:=@Weekday(newyear);
weektoday:=@If(@Weekday(@Today)=1;7;@Weekday(@Today)-1);

weeknumber:=((@Today-newyear)/86400-weektoday)/7+1;
weeknumber2:=@If(weeknumber=@Integer(weeknumber);0;1)+@Integer(weeknumber);

nextmonday:=@Date(@Adjust(@Today;0;0;8-weektoday;0;0;0)); nextsunday:=@Date(@Adjust(@Today;0;0;15-weektoday;0;0;0));
“第”+@Text(weeknumber2)+”周:从”+@Text(nextmonday)+”到”+@Text(nextsunday)

LS计算
function firstdateofthisweek(byval d as variant) as variant
firstdateofthisweek=d-weekday(d)+1
end function

function lastdateofthisweek(byval d as variant) as variant
lastdateofthisweek=d-weekday(d)+7
end function

发表评论

您的电子邮箱地址不会被公开。