quinta-feira, 7 de junho de 2012

Delphi - Função Decodetime - Separar H/M/S/M


Procedure TForm1.BitBtn1Click(Sender: TObject);
var Hora: TTime;
Hour, Min, Seg, MSeg : Word;
L:TStringList;
begin
        //Hora Atual
        Hora:=now;
        //Criando uma lista de strings
        L := TStringList.Create();
        //Utilizando a função para separar a H/M/S/M
        DecodeTime(Hora, Hour, Min, Seg, MSeg);
        L.Add('Hora Atual: '+timetostr(Hora));
        L.Add('Horas: '+inttostr(Hour));
        L.Add('Minutos: '+inttostr(Min));
        L.Add('Segundos: '+inttostr(Seg));
        L.Add('Milisegundos: '+inttostr(Mseg));
        ShowMessage(L.Text);

end;

Nenhum comentário:

Postar um comentário