Delphi-Quellcode:
function LastSaturday(
const AVAlue: TDateTime): TDateTime;
asm
add esp,-$14
push dword ptr [ebp+$0c]
push dword ptr [ebp+$08]
call [B]DayOfWeek[/B]
//DayOfTheWeek gibts nicht
movzx eax,ax
inc eax
neg eax
mov [ebp-$14],eax
fild dword ptr [ebp-$14]
fadd qword ptr [ebp+$08]
fstp qword ptr [ebp-$10]
wait
mov eax,[ebp-$10]
mov [ebp-$08],eax
mov eax,[ebp-$0c]
mov [ebp-$04],eax
fld qword ptr [ebp-$08]
mov esp,ebp
pop ebp
ret $0008
end;
procedure TForm7.FormCreate(Sender: TObject);
begin
ShowMessage(DateToStr(LastSaturday(Date)));
end;
liefert den 18.07.2014...
ShowMessage(DateToStr(Date-DayOfWeek(Date)));
liefert den 19.07.2014...
Jetzt kann sich jeder überlegen was stimmt