cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Arankin1
Frequent Visitor

How to convert a time value to a decimal value

Hi.  I'm trying to convert a time value to a decimal value, i.e. 7:30 = 7.5.  This date is the product of two different time picker boxes.

 

It looks like I could use DateDiff to return total minutes, however I want to use the date format in another spot (so I would use 7:30 on a label on the form and return back 7.5 to Sharepoint from my form).

 

Is there a way to do this?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Arankin1 
DATEDIFF will produce 7.5 if you change the 3rd argument to 'Hours'.

 

DateDiff(start_datetime, end_datetime, Hours)

 

Example:  this would return 7.5 hours.

 

DateDiff(
    Today() + Time(2,0,0),
    Today() + Time(9,30,0),
    Hours
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

1 REPLY 1
mdevaney
Super User III
Super User III

@Arankin1 
DATEDIFF will produce 7.5 if you change the 3rd argument to 'Hours'.

 

DateDiff(start_datetime, end_datetime, Hours)

 

Example:  this would return 7.5 hours.

 

DateDiff(
    Today() + Time(2,0,0),
    Today() + Time(9,30,0),
    Hours
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,141)