1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

EncodeTime

unit
Sysutils
category
date/time routines

declaration
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime

description
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.

example
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))

in real code

see also
EncodeDate, DecodeTime, TimeToStr,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.