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
nickduxfield Responsive Resident
Responsive Resident

Re: How to display all hours and minutes in drop down

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

Re: How to display all hours and minutes in drop down

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

SanAndresMan72
Regular Visitor

Re: How to display all hours and minutes in drop down

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

Re: How to display all hours and minutes in drop down

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.

UncountedBrute Helper I
Helper I

Re: How to display all hours and minutes in drop down

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

nickduxfield Responsive Resident
Responsive Resident

Re: How to display all hours and minutes in drop down

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

UncountedBrute Helper I
Helper I

Re: How to display all hours and minutes in drop down

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!

nickduxfield Responsive Resident
Responsive Resident

Re: How to display all hours and minutes in drop down

Sounds interesting. Give us a bell if allowed

nickduxfield Responsive Resident
Responsive Resident

Re: How to display all hours and minutes in drop down

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

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,176)