Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: klaussal am 15.11.02 - 11:34:30
-
moin moin,
weiss vielleicht irgend jemand, wie man problemlos aus einem datum (notes datumsfeld) die kalenderwoche berechnet ?
Vielen Dank im Voraus !!
klaushttp://
-
Aus eknoris Schatzkiste
Here's a possible solution. It will calculate the number of weeks from the start of the year. Replace @Now with the date you want to find the number of weeks for:
=================================
REM "Grab the current year";
year := @Year( @Now );
REM "Modify the start date to reflect when the first week of the year starts";
newYearDate := @Date( year; 1; 1 );
dayAdjust := @Select( @Weekday( newYearDate ); 0; -1; -2; -3; -4; -5; -6 );
startDate := @Adjust( newYearDate; 0; 0; dayAdjust; 0; 0; 0 );
REM "Get the number of weeks since the start";
weeks := @Round( ( ( @Now - startDate ) / 86400 ) / 7 );
@Prompt( [OK]; "Weeks"; "Weeks = " + @Text( weeks ) );
================================
You might have to tweak it just a little to get it how you want it.
-
Nur aus Interesse:
Hat jemand eine @Formel für den umgekehrten Weg, also DateTime Range aus KW-Angabe?
-
vielen danbk an die "schatzkiste"
klaus
-
Nur aus Interesse:
Hat jemand eine @Formel für den umgekehrten Weg, also DateTime Range aus KW-Angabe?
ich hab...sorry wenn ich da a bissi spät daherkomme damit, oder deine frage sich schon erledigt hat...
KW ist, wer hätte das gedacht, die Kalenderwoche ;)
1. Tag der Woche: MONTAG
@Adjust (@TextToTime("01.01."+ @Text(@Year(@Now))); 0;0;-(@Weekday(@TextToTime("01.01."+ @Text(@Year(@Now)))))+@TextToNumber(KW)*7-7+2; 0;0;0)
letzer Tag der Woche: SONNTAG
@Adjust (@TextToTime("01.01."+ @Text(@Year(@Now))); 0;0;-(@Weekday(@TextToTime("01.01."+ @Text(@Year(@Now)))))+@TextToNumber(KW)*7+1; 0;0;0)
lg
roo
-
Dankeschön, den Ansatz werde ich demnächst mal testen!