Mega Code Archive

 
Categories / Delphi / Examples
 

How to round Time to a quarter

Title: How to round Time to a quarter Question: 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;