SysUtilsStrToTime (Delphi)
Description
This example uses an edit box and a button on a form. When you enter a time in the edit box in the HH:MM:SS format, the string entered is converted to a TDateTime value. A message saying "Good Morning" or "Good Afternoon" (depending on whether the time entered was in the morning or afternoon) then appears.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
ATime: TDateTime;
begin
ATime := StrToTime(Edit1.Text);
if ATime < 0.50 then
ShowMessage('Good Morning')
else
ShowMessage('Good Afternoon');
end;
Uses
- System.SysUtils.StrToTime ( fr | de | ja )