3.2.4 计算本月第几周的公式

日期字段{周开始日期}存储每周开始的日期,日期字段{周结束日期}存储每周结束的日期,且设置计算公式为calcDate({周开始日期},6)。

假定数字字段{周}存储本月第几周,则以下为计算本月第几周的公式。

注意:下述公式中,{周开始日期}只能填写星期日或星期一!

如果

(weekday({周开始日期})=0 and day({周开始日期})>=26   and day({周结束日期})>=4) or (weekday({周开始日期})=0 and day({周开始日期})<=4) or (weekday({周开始日期})=1 and day({周开始日期})>=27 and day({周结束日期})>=5) or (weekday({周开始日期})=1 and day({周开始日期})<=5)

则为

1

如果

(weekday({周开始日期})=0 and day({周开始日期})>=5   and day({周开始日期})<=11) or (weekday({周开始日期})=1 and day({周开始日期})>=6 and day({周开始日期})<=12)

则为

2

如果

(weekday({周开始日期})=0 and day({周开始日期})>=12   and day({周开始日期})<=18) or (weekday({周开始日期})=1 and day({周开始日期})>=13 and day({周开始日期})<=19)

则为

3

如果

(weekday({周开始日期})=0 and day({周开始日期})>=19   and day({周开始日期})<=25) or (weekday({周开始日期})=1 and day({周开始日期})>=20 and day({周开始日期})<=26)

则为

4

如果

(weekday({周开始日期})=0 and day({周开始日期})>=26   and day({周结束日期})<4) or (weekday({周开始日期})=1 and day({周开始日期})>=27 and day({周结束日期})<5)

则为

5



否则为

0