You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Below code shows the example how to get year, month, day from the current date time:

var
  myDate : TDateTime;
  myYear, myMonth, myDay : Word;
begin
  // Set up the myDate variable to have a December 2000 value
  myDate := StrToDate('29/12/2000');

  // Now add a month to this value
  myDate := IncMonth(myDate);

  // And let us see what we get
  DecodeDate(myDate, myYear, myMonth, myDay);
  ShowMessage('myDate now = '+DateToStr(myDate));
  ShowMessage('myDay      = '+IntToStr(myDay));
  ShowMessage('myMonth    = '+IntToStr(myMonth));
  ShowMessage('myYear     = '+IntToStr(myYear));
end;


  • No labels