@Dorinda ,
To get a correct answer, a least when we are talking about hours, you need to use 2 context variables to keep the datetimeformat type for start and for end.
1. For The three controls represents the start datetime and the three controls represents the end datetime:
Set OnChange property to :
UpdateContext({
chosenStartTime:
DateTimeValue(
Text(
StartDatePicker.SelectedDate,"[$-en-GB]yyyy.mm.dd ")&
StartHourDropdown.Selected.Value&
":"&
StartMinuteDropdown.Selected.Value
)
)}
);
UpdateContext({
chosenEndTime:
DateTimeValue(
Text(
EndDatePicker.SelectedDate,"[$-en-GB]yyyy.mm.dd ")&
EndHourDropdown.Selected.Value&
":"&
EndMinuteDropdown.Selected.Value
)
)}
)
2. The workduration control (most propably a textinput control)
Default:
DateDiff(
chosenStartTime,
chosenEndTime,
if( Radio3.SelectedText.Value = "Hours",Hours,Days)
)