龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2022-11-2 11:17

【NthDayofMonth】

[code]Inputs: StrtDate(Numeric), Nth(Numeric), TargtDay(Numeric);

condition1 = DayOfWeek(JulianToDate(StrtDate)) <= TargtDay ;
If condition1 Then Begin
        NthDayofMonth = StrtDate + ((Nth - 1) * 7) + (TargtDay - DayOfWeek(JulianToDate(StrtDate)));
End
Else Begin
        NthDayofMonth = StrtDate + ((Nth) * 7) - (DayOfWeek(JulianToDate(StrtDate)) - TargtDay );
End;
[/code]

页: [1]