Subject Re: date to date weekdays
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 19 Apr 2025 09:51:06 +0200
Newsgroups dbase.getting-started
Attachment(s) weekdays.prg

On 2025/04/15 16:08, Samuel Partida wrote:
> how to remove weekend days from date to date to subtract (formula)
> I need to remove subtract all Saturday's and Sundays from any given date to date.

You don't tell us exactly what you need..

Do you want the number of days between two dates that are weekdays or do
you want a list of of the days between the dates that are not weekdays?

The attached program may give you some ideas on how to proceed.  If this
is not quite what you want then give us a bit more detail.


Mervyn.


clear
dStart = {2025/02/01}
dEnd = {2025/02/28}
dTest = dStart
nCount = 0
do while dTest <= dEnd
    if dow(dTest) <> 1 and dow(dTest) <> 7
       nCount ++
       ?dtest,cdow(dTest) //Commnet out this line if you only want a count
    endif
    dTest+=1
enddo    
?
? 'Number of weekdays between '+chr(13)+chr(10)+cdow(dStart)+' '+dStart+ ' and '+cdow(dEnd)+' '+dEnd +' is '+nCount