Page 1 of 1
Week2Month() Conversion function
Posted: Mon Oct 02, 2017 5:39 am
by unixkd
Hi all
I need a Function say Week2Month(nWeek, dDate) ----> nMonth
Where nWeek is 1-52 representing nWeek of the year
dDate default to Date()
Thanks
Joe
Re: Week2Month() Conversion function
Posted: Mon Oct 02, 2017 3:05 pm
by Auge_Ohr
unixkd wrote:I need a Function say Week2Month(nWeek, dDate) ----> nMonth
i use this to find Monday of a given Week / Year
Code: Select all
FUNCTION XF_KwMontag( nWoche, nJahr )
LOCAL dDay, nDayOfWeek, dDatum
dDay := CTOD( "01.01." + LTRIM( STR( nJahr, 4, 0 ) ) )
nDayOfWeek := IF( DOW( dDay ) = 1, 7, DOW( dDay ) - 1 )
dDatum := IF( nDayOfWeek < 5, dDay - 6 - nDayOfWeek + 7 * nWoche, dDay + 8 - nDayOfWeek + 7 * ( nWoche - 1 ) )
RETURN ( dDatum )
now it is easy to find Month
Re: Week2Month() Conversion function
Posted: Mon Oct 02, 2017 4:09 pm
by unixkd
Perfect !!!
Thanks Jimmy