/ Forums / Advansys Formativ / Creating Solutions with Formativ / Appointment duration from DateTime controls / Reply To: Appointment duration from DateTime controls

#7909
Support 1
Participant

>if I try .StartDate = DateTime1 (and .EndDate = DateTime2) then
>the result isn’t in the right format (and the applet errs out)

This will not work because the data type of DateTime1 and DateTime2 is DateTimePicker, whereas the data type of StartDate/EndDate is Date. See the Formativ Language Guide section on DateTimePicker and the GroupWise Object API documentation on Appointment.

Assuming iTimePeriodBegin and iTimePeriodEnd are updated to match the values set by the user in the dialog box, it looks like your appointment’s times are only partially set. The Formativ Language Guide section on DateTimePicker indicates that its properties include Date as well as Time. From your code excerpt it is not clear that the value of Date is included in iTimePeriodBegin/iTimePeriodEnd. To combine the values of Date and Time, simply add them:

  with DateTime1
    iTimePeriodBegin = .Date + .Time
  end with

I hope this helps.

Regards,
Advansys Support