Dear Friends,
I have a date sample 16.10.2015
I wish Know the week where there is this date
sample : from 12.10.2015 to 17.10.2015
exist a function give me this ?
thanks in advance
I need this because I must calculate how many times a teacher is on a specific classroom
calculate a week
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
calculate a week
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: calculate a week
The DOW() function?
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: calculate a week
Sorry,
DOW() returns the day of the week as a number between zero and seven.
I want the function return me the date of first day of the week and the date of the seven day of the week of the date past
sample if I have 16.10.2015 -----> give me 12.10.2015 and 18.10.2015
I hope you undestood me
DOW() returns the day of the week as a number between zero and seven.
I want the function return me the date of first day of the week and the date of the seven day of the week of the date past
sample if I have 16.10.2015 -----> give me 12.10.2015 and 18.10.2015
I hope you undestood me
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: calculate a week
Yes, that's right. But by using the function DOW(), you can get your goal like this :
Good luck !!!
Code: Select all
FUNCTION FirstLastDOW(dDate)
LOCAL cDow := DOW(dDate) // 1 = Sunday / 2 = Monday / ... / 7 = Saturday
LOCAL cFDate // last Monday before dDate
LOCAL cLDate // first sunday after dDate
cFDate = IF( cDow = 1, dDate - 6 , IF( cDow = 2, dDate, dDate - ( cDow - 2 ) ) )
cLDate = IF( cDow = 1, dDate, dDate + ( 8 - cDow ) )
RETURN({cFDate,cLDate})
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Re: calculate a week
wom(date()), i read your post now
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: calculate a week
FirstLastDOW(dDate) RUN GOOD ONLY
in Italy we have the first day monday and the six saturday ( seven sunday)
in Italy we have the first day monday and the six saturday ( seven sunday)
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC