web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Datevalue field, hour ...
Power Apps
Unanswered

Datevalue field, hour value field, minute value field: combine to subtract from a different date value, hour value and minute value field

(0) ShareShare
ReportReport
Posted on by 187

Hi all,

 

Need some help. I have a Date_Time Value Column from Sharepoint as a card in my view form which looks as follows:
Screenshot 2021-05-20 at 22.12.04.png

 

The datacard looks like this:
Screenshot 2021-05-20 at 22.13.37.png

 

 

 

 

 

 

 

 

 

 

I have another datacard which looks exactly the same format wise, but the date/time will be further in the future compared to the above date/timestamp, e.g. May 23, 2021 01:50.

 

What I would like to achieve is the following:
May 23, 2021 01:50 - May 22,2021 11:00 = 14 hours and 50 minutes difference. 

 

How to approach this? seen some examples about datediff and time diff but the combination I could not easily make and I guess I need a combination of those 2 to fix the above. Any help much appreciated!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    Hi @debarbanson ,

    Something like this

    With(
     {
     wDiff:
     DateDiff(
     DateCard1.SelectedDate + 
     Time(
     Value(HourCard1.Selected.Value), 
     Value(MinuteCard1.Selected.Value), 0
     ),
     DateCard2.SelectedDate + 
     Time(
     Value(HourCard2.Selected.Value), 
     Value(MinuteCard1.Selected.Value), 0
     ),
     Minutes
     ),
     },
     Text(RoundDown(wDiff/60,0)) & ":" & 
     Text(Mod(wDiff,60)
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • debarbanson Profile Picture
    187 on at

    Dear @WarrenBelz ,

     

    Many thanks for your reply! I have used your code and this would be the result: 

    With(
            {
             wDiff:
             DateDiff(
                   DateValue2.SelectedDate +
                   Time(
                         Value(HourValue2.Selected.Value),
                         Value(MinuteValue2.Selected.Value),0
                   ),
                  DateValue5.SelectedDate +
                  Time(
                          Value(HourValue5.Selected.Value),
                          Value(MinuteValue5.Selected.Value),0
                  ),
                 Minutes
             ),
          },
         Text(RoundDown(wDiff/60,0)) & ":" &
         Text(Mod(wDiff,60))
    )

     

    However I get an error message from Powerapps:
    Expected colon. We expected a colon (:) at this point in the formula. I can't seem to figure out where this should be present, any clue?

     

    I have for the moment split up 2 labels, one with the date diff and the other one with the Text Rounddown and that works so I'm puzzled why the combined version does not work.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 445

#2
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 321 Super User 2025 Season 2

Last 30 days Overall leaderboard