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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Getting hour value fro...
Power Apps
Answered

Getting hour value from string date

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, I will try to be as explicit as I can.

I have a gallery, with three labels: name, end date and initial date, both dates are (dd/mm/yyyy hh:mm). What I am trying to do is when I filter by name, get the total duration of all the records that are display. kind of end date 1 less initial date 1, and add it to the next result and so on. Also the result I am trying to get it in both  just hours (hh:mm) and float value, say 1:30 would be 1.5.

 

I found that TimeValue(Label.Text) gives me the hour, but when I use it in an operation that should reult in "1:40", gives me 6000000

 

Any help or suggestions on how to do it would be great, thanks!

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    The result of TimeValue() displays in milliseconds. If your formula TimeValue(Label.Text) results in 6000000 that’s in milliseconds. To get the desired result make your formulaas shown below.  The output with be 1.67 (e.g. the float format of 1:40).

     

    TimeValue(Label.Text) / 1000 / 60 / 60

     

    ---

    Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Based on the issue that you mentioned, it seems that the TimeValue(Label.Text) formula has been converted into millisecond within your formula.

     

    Please consider modify your formula as below:

    Round(TimeValue(Label.Text)/1000/60/60, 2) /* <-- Convert it into hours in float value */

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for the reply. How do I convert that float value into hour fomat?

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    I have two ideas for you:

     

    1.  Use the DateDiff() function.  The arguments are (start_date, end_date, [units]).  The official Microsoft documentation has several examples

     

    2.  Use the Time() function.  To get the result in hour format use formula as shown below:

     

    Text(RoundDown(Label.Text/1000/60/60,0),"[$-en-US]0")&":"&Text(Round((RoundDown(Label.Text/1000/60/60,2)-RoundDown(Label.Text/1000/60/60,0))*60,0),"[$-en-US]00")

     

    DateDiff() is really the easiest solution to understand though.

     

    ---

    Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard