Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime
Creates a TDateTime value from Hour, Min, Sec, and MSec. values.
Valid Hour values are 0 through 23. Valid Min and Sec values are 0 through 59. Valid MSec values are 0 through 999. If the specified values are not within range, an EConvertError exception is raised.
The resulting value is a number between 0 (inclusive) and 1 (not inclusive) that indicates the fractional part of a day given by the specified time.
The value 0 corresponds to midnight, 0.5 corresponds to noon, 0.75 corresponds to 6:00 pm, and so on.
var H, M, S, MS: Word;
dt: TDateTime;
H:=8;
M:=58;
S:=18;
MS:=45;
dt:=EncodeTime(H,M,S,MS);
ShowMessage('The time is ' + TimeToStr(dt))
|
EncodeDate,
DecodeTime,
TimeToStr,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|