cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wedwards
Level: Powered On

Date Time Picker -- Missing Time

I added the Date control to a card but the time portion is not present.  I am using the current version of PowerApps.

What should I do to be able to also choose a time?  I am using the Web version on a PC if that affects my view.

 

Thank you,

 

 

W.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Date Time Picker -- Missing Time

Hi @wedwards,

 

The DatePicker control is only available for Date, there is no time control available under PowerApps.

To workaround this, we need to add two dropdown, one for hour, and another for Minutes

HourDropdown:

Items property (24 hours):

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

MinutesDropdown:

Items property:

["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"]

Together with the DatePicker control, within one DataCard, then use the following formula to combine the time value with the date value under the Update property of the DataCard control:

DateValue1.SelectedDate + Time(Value(HourDropdown.Selected.Value), Value(MinutesDropdown.Selected.Value), 0)

Reference:

86.PNG

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Community Support Team
Community Support Team

Re: Date Time Picker -- Missing Time

Hi @wedwards,

 

The DatePicker control is only available for Date, there is no time control available under PowerApps.

To workaround this, we need to add two dropdown, one for hour, and another for Minutes

HourDropdown:

Items property (24 hours):

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

MinutesDropdown:

Items property:

["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"]

Together with the DatePicker control, within one DataCard, then use the following formula to combine the time value with the date value under the Update property of the DataCard control:

DateValue1.SelectedDate + Time(Value(HourDropdown.Selected.Value), Value(MinutesDropdown.Selected.Value), 0)

Reference:

86.PNG

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

wedwards
Level: Powered On

Re: Date Time Picker -- Missing Time

That worked perfectly. 

 

I like this solution a lot because I actually wanted to restrict the minutes to every 15 or 30 minutes, so I was able to achieve that.

 

Minutes property:

["00","15","30","45"] or ["00","30"] 

 

Thank you,

 

W.

sblake
Level: Powered On

Re: Date Time Picker -- Missing Time

I did this by using a Label and Slider.

 

Slider called sldTimer

 

The Min property of sldTimer to 0

The Max property of the sldTimer to the number of increments of the time in a 24 hour period you want to jump. In my example I wanted to go up by 5 minute intervals so just quickly calculated how many 5 minutes there are in 24 hours:

 

Number of increments = 24*60/5

 

Label called lblTime

 

set Text property of lblTime to:

 

Text(Time(RoundDown((sldTimer.Value * 5)/60,0), Mod(sldTimer.Value * 5, 60) - Mod(Mod(sldTimer.Value * 5, 60), 5), 00), "[$-en-US]HH:mm AM/PM")

 

for the above the 5 represents the time increment I am looking for and 60 is the number of minutes in an hour.

 

Obviously some of the maths would change if you want it to go up by seconds, or you just want to create a timer between two specific times, but not difficult to extrapolate the above.

 

Capture.PNG

 

 

 

Boneckrh19
Level 8

Re: Date Time Picker -- Missing Time

Michael I love your solution, although what do you recommend for a version of this that uses am and pm? Is there an efficent way to have a time picker that goes to 12 and then starts over, or one with an am/pm option?

Justas
Level: Powered On

Re: Date Time Picker -- Missing Time

Hello I am trying to set Timer and I am getting problem with the + sign when trying update Card and error is saying:Expected Record Value. hour and minute drop downs and date picker are good without any errors. I have attached screen shot of the error and function.

Boneckrh19
Level 8

Re: Date Time Picker -- Missing Time

@Justas 

You should make this a new question! It doesn't relate to the question being asked on this thread. 

 

Also, what do you mean by "set a timer"? Are you setting the value on the Duration property of a Timer control?

dmistry
Level 8

Re: Date Time Picker -- Missing Time

Thanks Michael. So based on your solution, I have From and To as two date picker controls added in powerapps and also the Hours and mins drop-downs as well:. Now how do i calculate a decimal difference between the two?

 

Let's say:1 From Field: User selects: 5 (in hours drop down) , 00 (in mins drop Down)

              2. To Field user selects: 6 (in hours drop down), 40 (in mins dd) 

 

So how can i calculate the difference in decimal which would be 1.7 between 5 and 6:40 pm, thoughts? @v-micsh-msft 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,930)