Hi everybody. I need to calculate hours between two dates from a text label. What i tried is giving me 6 hours as a result.
Here´s what i spect:
StartDate: 20/02/2022 23:00
EndDate: 21/02/2022 04:30
Total Hours: 5 hours
This is what i tried:
"Total Hours: " & DateDiff(DateTimeValue(start_date_label.Text); DateTimeValue(end_date_label.Text);Hours)
Any help will be much appreciated.
Don't forget RoundUp
Hi @madcoderz,
Here is what I achieve on my side:
I will suggest you use a Date time picker to display date time value.
Thanks for the answer but the result is also wrong. Is giving 7 hours when it should be 5 hours.
TextInput1: "01 Mar 2022 11:00 PM"
TextInput1_1: "02 Mar 2022 04:30 AM"
Label: Total hours: 6
"Total Hours: " & RoundUp(
DateDiff(
DateTimeValue(TextInput1.Text),
DateTimeValue(TextInput1_1.Text),
Minutes
) / 60,
0
)
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional