cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrleetyler
Resolver II
Resolver II

datediff display as hh:mm

hi all

 

i am trying to do a DateDiff and display the result as a time factor.

 

e.g. 13:00 start 14:00 end i'd want the datediff to display at 01:00 not 60,1,3600 etc.

 

i'm working with this at the moment but it just doesn't work

the date diff displays correctly but i cannot get the format of the seconds converted to a time factor

 

is there a way to do this?

Text(DateDiff(DateTimeValue(input_ShiftStart.Text),DateTimeValue(input_ShiftEnd.Text),Seconds),"[$-en-US]hh:mm")

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @mrleetyler 

 

Minutes Included.

Text(DateDiff(TimeValue(input_ShiftStart.Text),TimeValue(input_ShiftEnd.Text),Hours), "[$-en-US]00") &  ":" & Text(Mod(DateDiff(TimeValue(input_ShiftStart.Text),TimeValue(input_ShiftEnd.Text),Minutes), 60),"[$-en-US]00")

 

StalinPonnusamy_0-1632109601472.png

 

View solution in original post

3 REPLIES 3
StalinPonnusamy
Super User
Super User

Hi @mrleetyler 

Text(DateDiff(TimeValue(input_ShiftStart.Text),TimeValue(input_ShiftEnd.Text),Hours), "[$-en-US]00") & ":00"

 

StalinPonnusamy_0-1632108641497.png

 

hey Stalin,

 

that works fine for exact hours but in the event of for example a 90 minute datediff this method won't work

StalinPonnusamy
Super User
Super User

Hi @mrleetyler 

 

Minutes Included.

Text(DateDiff(TimeValue(input_ShiftStart.Text),TimeValue(input_ShiftEnd.Text),Hours), "[$-en-US]00") &  ":" & Text(Mod(DateDiff(TimeValue(input_ShiftStart.Text),TimeValue(input_ShiftEnd.Text),Minutes), 60),"[$-en-US]00")

 

StalinPonnusamy_0-1632109601472.png

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,762)