Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20758

BASCOM-AVR : Calculating date from # of occurance of Sunday in a month? : NEWTOPIC

$
0
0
So I've been using the following to determine the nth occurrence of a day within a month [code:1:1a2ea0fed7]Function DayNameCountCurrentMonth() As Byte Local Temp_Day As Integer Local Day_Name_Counter as Byte Day_Name_Counter = 1 Temp_Day = _DAY 'here we get a number from 1 to 31 (Current system date). Temp_Day = Temp_Day - 7 'previous week While Temp_Day > 0 Incr Day_Name_Counter Temp_Day = Temp_Day - 7 'previous week Wend DayNameCountCurrentMonth = Day_Name_Counter End Function[/code:1:1a2ea0fed7] So far, so good But how to determine the date of a specific weekly occurrence of a day based on the actual date? In other words, if I have a date of 07.24.19, how can I calculate that is the 4th Wednesday of July? [b:1a2ea0fed7][color=red:1a2ea0fed7](BASCOM-AVR version : 2.0.8.1 )[/b:1a2ea0fed7][/color:1a2ea0fed7]

Viewing all articles
Browse latest Browse all 20758

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>