Week2Month() Conversion function

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Week2Month() Conversion function

#1 Post 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

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Week2Month() Conversion function

#2 Post 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
greetings by OHR
Jimmy

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: Week2Month() Conversion function

#3 Post by unixkd »

Perfect !!!

Thanks Jimmy

Post Reply