0

I am using C++ Builder in a VCL forms application.

I am wanting to create one TDateTime variable that is made up of two TDateTimePicker controls.

One of the controls is in the Date format and the other is in the Time format.

I am wanting to combine them both into one TDateTime variable.

For example, the DateTimePickerAppointmentDate shows "25/09/2012" and the DateTimePickerAppointmentTime shows "7:02:13 p.m."

I have tried the following code:

TDateTime testCombine = DateTimePickerAppointmentDate->Date + DateTimePickerAppointmentTime->Time;

However, the DateTimePickerAppointmentDate->Date is not just the date from the control, it is the Date and Time. Same goes for the DateTimePickerAppointmentTime->Time.

Do I have to separate the Date and Time from each to get the desired output via a function, or is there a feature of the DateTimePicker to just return the date or time from the controls?

Thanks

user1690531
  • 231
  • 1
  • 6
  • 17

1 Answers1

0

Solved it. Here is my code:

TDateTime appDate = DateOf(DateTimePickerAppointmentDate->Date) + TimeOf(DateTimePickerAppointmentTime->Time);
user1690531
  • 231
  • 1
  • 6
  • 17