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
 

EncodeDate

unit
Sysutils
category
date/time routines

declaration
function EncodeDate(Year, Month, Day: Word): TDateTime

description
Creates a TDateTime value from Year, Month, and Day values.

The Year must be between 1 and 9999. Valid Month values are 1 through 12. Valid Day values are 1 through 28, 29, 30, or 31, depending on the Month value.
If the function fails, EncodeDate raises an EConvertError exception.

example
var  Y, M, D: Word;
     dt: TDateTime;

y:=2001;
M:=2;
D:=18;

dt:=EncodeDate(Y,M,D);

ShowMessage('Borna will be
             one year old on ' + DateToStr(dt))

in real code

see also
DecodeDate DecodeTime


 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

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

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

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

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

All rights reserved.