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 / Problems with displayi...
Power Apps
Unanswered

Problems with displaying Time from dropdowns

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I created some dropdowns for choosing a time. The initial idea was to calculate the difference between END & Start time, which would then give a precise time.

The dropdowns look like this:

Screenshot 2021-05-01 122814.png

So we have 4 dropdowns in total: (from left to right) "HourValueStart", "MinuteValueStart", "HourValueEnd", "MinuteValueEnd"

I tried following code first:

 

Text(Time(
 Value(HourValueEnd.Selected.Value) - Value(HourValueStart.Selected.Value);
 Value(MinuteValueEnd.Selected.Value) - Value(MinuteValueStart.Selected.Value);
 0))

 

but once I want to submit this, it returns an error saying "Invalid value '1619823600000' for field 'Einsatzzeit', expected a string".

 

Then I tried something else:

 

HourValueStart.Selected.Value & ":" & MinuteValueStart.Selected.Value & " - " & HourValueEnd.Selected.Value & ":" & MinuteValueEnd.Selected.Value 

 

with the goal to display exactly what was given as input. In this case it would have been "06:00 - 07:00". When I submit and go to check, it is just blank. In the spreadsheet (where it is stored once we hit the submit button) the column "Einsatzzeit" is also blank.

Anyone an idea what the issue could be?

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous  - I have a sneaking suspcicion that those drop down controls are on a form that is in edit mode?

    I could be completely wrong, but when I went to generate the dropdowns from an Excel table, by adding an Edit Form and specifying the table as the data source and finally adding in the two date columns in the table. If you were to play or just see the results everything was blank.

     

    The penny then dropped when I realised of course it will be blank because I am in the edit mode of the form, without being in the context of an item within the data source. So this would work if we referenced a row in the excel spreadsheet for example.

     

    However I was not bothered about that due to just wanting to set something up to provide you with some advice, so I just went to the form and set it to New mode and I now have the following results.

    The first label is using your code.

     

    Then second is doing Date Diff.

     

    The final is just me sanity checking that I can surface one of the hour values.

     

    HenryARPhillips_0-1619888644475.png

    Or you could probably just specify an item by doing something like 

    HenryARPhillips_1-1619888815738.png

    Or if you don't want the form and be able to switch between new entries and edit entries. Maybe just copy the controls out of the form and use them independently.

     

    Thanks

     

    Henry

     

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Hi @Anonymous ,
    See below - you need ; instead of , for your region, but this produces the result you require

    TimeDiff.png

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @WarrenBelz . I tried the suggested change, but it still returns an error saying "Invalid value '1619823600000' for field 'Einsatzzeit', expected a string".

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    @Anonymous ,

    What are the Items and Default of your drop-downs and are they drop-down or combo box controls?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz,

     

    The Items of the drop-downs are like this:

     

    ["00";"01";"02";"03";"04";"05";"06";"07";"08";"09";"10";"11";"12";"13";"14";"15";"16";"17";"18";"19";"20";"21";"22";"23"]

     

    and the Default is like this:

     

    Text(Hour(Parent.Default);"00")

    (obviously for minute it is "Text(Minute(Parent.Default);"00")"

     

    Those are drop-downs and not combo box controls.

    Screenshot 2021-05-03 120148.png

     

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Thanks @Anonymous ,

    I was hoping for something different there to explain the error, but they are standard items generated by Power Apps. Have another look at the post I made earlier which was on a label and duplicate it (with your regional syntax) and see if you get an error (as it works perfectly here).

    Also, what type of field is  'Einsatzzeit'

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz,

     

    I did the test with a label, and it works there:

     

    Screenshot 2021-05-04 134726.png

    So it shows no error. 'Einsatzzeit' is of type 'DateTime', if that's what you're asking.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz,

     

    I formatted the column 'Einsatzzeit' to Time. Then, I removed the 'Text()' function, such that a result of type 'Time' is returned. Then I got a result in following format: "dd.mm.yyyy hh:mm" Afterwards I re-added the 'Text()' function to the code and used some concatenation to only display time and now it works for some reason?

     

    The only issue that remains is, that in the spreadsheet, it still stores the result as "dd.mm.yyyy hh:mm". How can I store only "hh:mm" ?

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The solution was to change the datatype to Text and just display plain text instead of DateTime. What I am currently trying to find out is, how to set the default values of each dropdown control such that, when the user is editing, that it doesn't reset to 00, but remains the value it was upon creation...

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    @Anonymous ,

    Date/Time fields are either Date only or Date/time (not time only). The date is actually stored with a time of 00:00.

    Are you using Excel here? If so, you might want to watch this video.

     

    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.

     

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard