title image


Smiley nur so zum Spaß Die Funktion für die Berechnung der KW ....
ISO mässig schaut schon einmal so aus:



REM " routine to figure out the week of the year a given date falls into --- for those applications that require a 53 week year";

REM " (i.e. those applications where the last week of the year is the first few days of the week that";

REM " splits across a year end boundary";

REM " it's also true that the first week of the year is defined as the last days of the week that splits across a year end boundary.";

REM " Its actually possible to get 54 week years by this definition!";



REM " Set the below Variable (SourceDate) to the value of the field that contains the date we will work on";



SourceDate := ;



REM "First figure out what the first day of the year in question is.";



FirstOfYear := @Date(@Year(SourceDate); 1; 1);

FirstDayNum_SundayBased := @Weekday(FirstOfYear);

FirstDayNum_MondayBased := @If(FirstDayNum_SundayBased = 1; 7;

FirstDayNum_SundayBased -1);



REM "Then get the week of the year for this date";

WeekOfYear_Gross := @Integer(@Integer(((SourceDate - FirstOfYear) / (86400)) + 1) / 7) +1;



REM "Then adjust the week because the first day of they year may not fall on Monday";



DayOfWeek := @Weekday(SourceDate);

WeekOfYearNum := @If(DayOfWeek >= FirstDayNum_MondayBased; WeekOfYear_Gross;

WeekOfYear_Gross + 1);



Und dann geht es eigentlich nur noch mit @if weiter



Halbjahr := @if(Weekofyearnum>26;"2. Halbjahr";"1. Halbjahr");

Quartal := @if(Weekofyearnum >39;"4. Quartal";Weekofyearnum >26;"3. Quartal";Weekofyearnum >13;"2. Quartal";"1. Quartal");



@text(sourceDate) + "ist das " + Quartal + " im " + Halbjahr



Thomas






Notes und Exchange, das ist wie Ferrari und Lada. Dreimal darfst du raten was der Ferrari ist.

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: