Mirror

Round Time to a quarter (Views: 708)


Problem/Question/Abstract:

How to round Time to a quarter
Exemple 11:18:21 ----> 11:15:00

Answer:

function Quarter(T: TTime): TTime;
var
  H, M, S, ms: Word;
begin
  DecodeTime(T, H, M, S, ms);
  M := (M div 15) * 15;
  S := 0;
  Result := EncodeTime(H, M, S, ms);
end;

<< Back to main page