19. Februar 2019 18:28
19. Februar 2019 18:40
Wochen := Tage div 7;
RestTage := Tage mod 7;
Ausgabe := StrSubstNo('%1W %2T', Wochen, RestTage);
19. Februar 2019 19:23
IF StartingDate = EndingDate THEN BEGIN
EXIT('<0D>');
END;
Negative := StartingDate > EndingDate;
TempDate := StartingDate;
IF Negative THEN BEGIN
WHILE TempDate > EndingDate DO BEGIN
TempDate := CALCDATE('<-1Y>',TempDate);
Years += 1;
END;
IF TempDate <> EndingDate THEN BEGIN
TempDate := CALCDATE('<1Y>',TempDate); // 1 step back
Years -= 1;
WHILE TempDate > EndingDate DO BEGIN
TempDate := CALCDATE('<-1M>',TempDate);
Months += 1;
END;
IF TempDate <> EndingDate THEN BEGIN
TempDate := CALCDATE('<1M>',TempDate); // 1 step back
Months -= 1;
WHILE TempDate > EndingDate DO BEGIN
TempDate := CALCDATE('<-1D>',TempDate);
Days += 1;
END;
END;
END;
IF Years > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('-%1Y',Years);
END;
IF Months > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('-%1M',Months);
END;
IF Days > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('-%1D',Days);
END;
NewDateFormula := '<' + NewDateFormula + '>';
END ELSE BEGIN
WHILE TempDate < EndingDate DO BEGIN
TempDate := CALCDATE('<1Y>',TempDate);
Years += 1;
END;
IF TempDate <> EndingDate THEN BEGIN
TempDate := CALCDATE('<-1Y>',TempDate); // 1 step back
Years -= 1;
WHILE TempDate < EndingDate DO BEGIN
TempDate := CALCDATE('<1M>',TempDate);
Months += 1;
END;
IF TempDate <> EndingDate THEN BEGIN
TempDate := CALCDATE('<-1M>',TempDate); // 1 step back
Months -= 1;
WHILE TempDate < EndingDate DO BEGIN
TempDate := CALCDATE('<1D>',TempDate);
Days += 1;
END;
END;
END;
IF Years > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('%1Y',Years);
END;
IF Months > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('+%1M',Months);
END;
IF Days > 0 THEN BEGIN
NewDateFormula += STRSUBSTNO('+%1D',Days);
END;
NewDateFormula := DELCHR(NewDateFormula,'<','+');
NewDateFormula := '<' + NewDateFormula + '>';
END;
EXIT(NewDateFormula);
19. Februar 2019 23:22
26. Februar 2019 00:03