i´m working on my Outlook Calendar Clone using HMG and have some Question how it is used in "your" Country
a.) first Day of Week :
in Germany it is Monday.
will harbour "set" right Day for DOW()
b.) Week of Year :
Code: Select all
FUNCTION XF_WeekofYear( dDatum )
LOCAL nDay, nWoche
nDay := DOW( CTOD( "31.12." + STR( YEAR( dDatum - 7 ), 4 ) ) )
nDay := IF( nDay = 1, 7, nDay - 1 )
nWoche := ROUND( ( dDatum - CTOD( "1.1." + STR( YEAR( dDatum ), 4 ) ) ;
+ 8 - IF( DOW( dDatum ) = 1, 7, DOW( dDatum ) - 1 ) ) / 7, 0 )
nWoche := IF( nWoche < 53, nWoche, IF( nDay > 3, nWoche, 1 ) )
// if 4 Days or more in new Year -> 1st Week
nWoche := INT( IF( nWoche = 0, IF( nDay > 4, 52, 53 ), nWoche ) )
RETURN ( nWoche )
Code: Select all
FUNCTION XF_WeeksinMonth( dDatum )
LOCAL nYear,nMonth,dFirst,dLast
LOCAL nDiff := 0
LOCAL nWeeks := 5
dFirst := STOD( STRZERO( nYear, 4 ) + STRZERO( nMonth, 2 ) + "01" )
dLast := STOD( STRZERO( nYear, 4 ) + STRZERO( nMonth + 1, 2 ) + "01" )
nDiff := dLast - dFirst
IF ( DOW( dFirst ) > 6 .OR. DOW( dFirst ) = 1 ) .AND. nDiff > 28
nWeeks := 6
ENDIF
RETURN nWeeks
thx for help