Skip to end of metadata
Go to start of metadata

When getting system date time information, DecodeDate() is useful.

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

  myDate : TDateTime;
  myYear, myMonth, myDay : Word;
  // 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));