Skip to main content

How to Combine a Date and a Time in Power Apps with DateTime

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A date picker gives you a date, a time picker a time; many things need both, as one moment. DateTime builds it from the parts: DateTime(Year(d), Month(d), Day(d), Hour(t), Minute(t), 0) is time t on day d.

The example is the Overtime Timesheet app, which puts the start and finish times people choose onto the day the shift started.

Syntax​

Syntax
DateTime(Year, Month, Day, Hour, Minute, Second [, Milliseconds])

DateTime combines the Date and Time functions into a single function (Date, DateTime, and Time functions). The result is a date and time in the app user's time zone.

Step 1: Build a Date and Time​

I put each formula into a text control's Text for a moment, so Studio's preview strip shows the result:

Any text control → Text
DateTime(2026, 10, 24, 22, 0, 0)

The strip shows 24/10/2026, 22:00:00, of type DateTime:

The formula bar with DateTime(2026, 10, 24, 22, 0, 0), the preview strip reading 24/10/2026, 22:00:00 with Data type DateTime, and the text control showing 24/10/2026 22:00

Step 2: Build It from a Date and a Time​

With a date d and a time t, take the parts with Year, Month and Day and Hour and Minute. With names the two values so the formula reads clearly (How to Use the With Function in Power Apps):

Any text control → Text
With(
{d: Date(2026, 11, 6), t: Time(17, 30, 0)},
DateTime(Year(d), Month(d), Day(d), Hour(t), Minute(t), 0)
)

Half past five on 6 November:

The formula bar with a With formula that names d as Date(2026, 11, 6) and t as Time(17, 30, 0) and returns DateTime(Year(d), Month(d), Day(d), Hour(t), Minute(t), 0), the preview strip reading 06/11/2026, 17:30:00 with Data type DateTime, and the text control showing 06/11/2026 17:30

Step 3: Use It with Real Controls​

In the app, the date is a date picker's SelectedDate and the time is a combo box's chosen Time (How to Let Users Pick a Time in Power Apps). The app wraps the formula in a user-defined function, so every screen builds the start the same way (How to Create a User-Defined Function in Power Apps):

App → Formulas
ShiftStart(ShiftDate: Date, StartAt: Time): DateTime =
DateTime(Year(ShiftDate), Month(ShiftDate), Day(ShiftDate), Hour(StartAt), Minute(StartAt), 0);

And calls it with the controls:

Calling it
ShiftStart(dpWorkDateLO.SelectedDate, cmbStartLO.Selected.Value)

Why Not Add the Date and the Time?​

Microsoft's data types page says adding and subtracting date and time values directly isn't recommended because time-zone and other conversions could cause confusing results. It recommends DateAdd and DateDiff for adding and subtracting.

DateTime sidesteps the question: it says which clock time on which day you mean. On the night the clocks went back in 2026, DateTime(2026, 10, 24, 22, 0, 0) and DateTime(2026, 10, 25, 6, 0, 0) were 540 minutes apart by DateDiff: nine real hours, although the clocks say eight. How to Calculate Hours Across a Daylight Saving Time Change in Power Apps shows it.

Common Mistakes​

MistakeWhat happensDo this instead
Adding a time to a date with +Microsoft warns of confusing resultsBuild it with DateTime
Passing a combo box record instead of its timeHour(cmbStartLO.Selected) isn't a timecmbStartLO.Selected.Value
Building a date and time from a blank date or timeA wrong moment, such as midnightCheck both with IsBlank first
Forgetting the seconds argumentDateTime needs itPass 0

Troubleshooting​

SymptomLikely causeFix
The time is midnightThe time was blankCheck that a time was chosen
The date is a day out in another time zoneTimes are shown in each user's time zoneSee Troubleshoot date and time issues

FAQ​

What time zone is the result in?​

The app user's. Microsoft's data types page explains that canvas apps hold date and time values in UTC and show them in the user's time zone, which comes from the browser or device.

What about a finish time after midnight?​

It belongs to the next day. Add a day to the date first when the finish is earlier than the start: How to Calculate Hours for an Overnight Shift in Power Apps.

Conclusion​

DateTime(Year(d), Month(d), Day(d), Hour(t), Minute(t), 0) puts time t on day d. Wrap it in a function if several formulas need it, and let DateDiff measure between the results.

Additional Resources​