Combine Date and Time…

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #52990
    CheshireCat
    Participant

      Hello John,

      the following code should work for you:

      Code:
      uses
      DateUtils;

      var
      MyAlphaDateTime : TDateTime;

      procedure TForm1.FormCreate(Sender: TObject);
      begin
      //initialize…

      sDateEdit1.Date := Now;
      sTimePicker1.Time := Time;

      MyAlphaDateTime := sDateEdit1.Date + sTimePicker1.Time;
      Label2.Caption := DateTimeToStr(MyAlphaDateTime);

      end;

      procedure TForm1.sDateEdit1Change(Sender: TObject);
      begin
      MyAlphaDateTime := sDateEdit1.Date + sTimePicker1.Time;
      Label2.Caption := DateTimeToStr(MyAlphaDateTime);
      end;

      procedure TForm1.sTimePicker1Change(Sender: TObject);
      begin
      MyAlphaDateTime := sDateEdit1.Date + sTimePicker1.Time;
      Label2.Caption := DateTimeToStr(MyAlphaDateTime);
      end;

      #52996
      JohnG
      Participant
        Quote:

        the following code should work for you:

        So that's how you do it. Thanks!

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.