cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UncountedBrute
Helper I
Helper I

How to display all hours and minutes in drop down

I am trying to use a DatePicker to select the date and time that a user wants. However the current implementation on PowerApps only seems to allow me to modify the date element and not the time.

 

To combat this, i am building two drop downs, one for hours and another for minutes. However, having to painstakingly right the numbers from 0 to 23 and 00 to 59 is getting rather annoying.

 

Does anyone know a faster, more efficient implementation of this, or if i am getting this completely wrong and there is a completely different way, please let me know.

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

If you have the Date and Time source column it should produce the below. You can use the syntax if you are trying to create your own date and time field. However, is there a need? Let me know if I'm off point.

A quick way is to quickly make another source list of one column as a complex type Date and Time field. SharePoint Lists allow this to be fast. Then you import that data source, and copy all the controls to your own destination. Then you can remove the datasource. Let it build that for you.

Otherwise copy the syntax directly in the controls.

Minutes Items

["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]

Hours Items

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

Update (DataCard)

DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0)

(Its numbers so its just adding)

 

dateandtime1.PNG

 

 

 

 

 

 

 

 

 

 

 

dateandtime3.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

dateandtime5.PNGdateandtime2.PNG dateandtime4.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

View solution in original post

8 REPLIES 8
bean
Continued Contributor
Continued Contributor

I cant figure anything out, other than writing them all out..

 

Not sure what the purpose of your app is, but if the user is perhaps booking something, you could make it go in 5,10,15 or 30 minute intervals. This will make the list far less cluttered too. In addition, you could make the hours column only run 1-12 and then have a toggle for am/pm. 

 

If the scenario is that the user needs their exact time, you could use the Now() function

 

Sean

You could setup a SharePoint list/Excel spreadsheet/CSV file for the hours and another list for the minutes then bound each control to the list

 

MG.-

Mariano Gomez, MVP

 

nickduxfield
Responsive Resident
Responsive Resident

What data source are you writing to?

Do you have a complex type date & time field  in that source or are you going for a number field? Or are you trying to accomplish this using single line of text.

We are writting to Dynamics 365 on a date time field.

If you have the Date and Time source column it should produce the below. You can use the syntax if you are trying to create your own date and time field. However, is there a need? Let me know if I'm off point.

A quick way is to quickly make another source list of one column as a complex type Date and Time field. SharePoint Lists allow this to be fast. Then you import that data source, and copy all the controls to your own destination. Then you can remove the datasource. Let it build that for you.

Otherwise copy the syntax directly in the controls.

Minutes Items

["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]

Hours Items

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

Update (DataCard)

DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0)

(Its numbers so its just adding)

 

dateandtime1.PNG

 

 

 

 

 

 

 

 

 

 

 

dateandtime3.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

dateandtime5.PNGdateandtime2.PNG dateandtime4.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yeh, this was what i built the drop downs off of. However the process we are reproducing requires a slightly different approach to this. Rather than getting users to fill out forms directly, we are getting them to fill out questions which then get mapped to the forms hidden elsewhere on powerapps. This is so we can ensure we can match the data that is already in existinance within CRM.

 

Thanks for your help!

Sounds interesting. Give us a bell if allowed

Just updates the post with the syntax so you can copy and paste

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,163)