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

Converting digits to time

Hi,

 

I wonder if it's possible to convert normal digits into a time format. I currently have a form containing a number of fields. One of the fields contains a  time value converted to text which is automatically filled in when the form is opened, by taking a time-stamp through the Now function. All is well and good up till here.

 

However, the user also has the possibility to modify the time manually if need be. The issue arises if the user erases the time and does not insert a colon (:) between the hours and minutes in the newly inserted time i.e. 0830 instead of 08:30. This will create some issues later on for my flow.  

Is there a possibility to overcome this by for example switching the digits to time i.e. inserting the colon after the first two digits? I was trying to solve this through the Update field of the datacard, but can't find a proper solution. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Converting digits to time

@danchircop

The problem with allowing a user to enter the time in a text field is there are too many situations to plan for.  We might able to solve the semi-colon scenario but then what next?  What if the user manually writes AM/PM?  Then we would have to keep on creating fixes.

 

Instead I would suggest getting the time using a double-dropdown like this.  The dropdown will only let a user select valid values and we can ensure Flow gets the proper data.

Capture.PNG

 

The time 0700 would be obtained by doing this.

Dropdown1.Selected.Value&Dropdown2.Selected.Value

 

Let me know if you are interested in this method and need more instructions.  Also, I would like to know what type of field this is in SharePoint (Text, Number, or Time).

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Converting digits to time

@danchircop

The problem with allowing a user to enter the time in a text field is there are too many situations to plan for.  We might able to solve the semi-colon scenario but then what next?  What if the user manually writes AM/PM?  Then we would have to keep on creating fixes.

 

Instead I would suggest getting the time using a double-dropdown like this.  The dropdown will only let a user select valid values and we can ensure Flow gets the proper data.

Capture.PNG

 

The time 0700 would be obtained by doing this.

Dropdown1.Selected.Value&Dropdown2.Selected.Value

 

Let me know if you are interested in this method and need more instructions.  Also, I would like to know what type of field this is in SharePoint (Text, Number, or Time).

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

danchircop
Level: Powered On

Re: Converting digits to time

Hi,

 

thanks for the reply and solution. I tried your suggestion and I managed to get working although I must admit it wasn't that straight forward, since as I said I'm working with time stamps and I wanted to get the timestamp showing in the dropdown menus as well. Besides, I had an extra space that was being created in the timestamp which gave me quite a hard time until I realised what was going on.

Anyway, I am happy that I got it to work, thanks to your suggestion, and should hopefully solve the issue of entering incorrect values.

 

One small question, how did you manage to resize the dropdowns as shown in the image you posted? I never managed to resize the dropdown button and chevron to that size.

 

Thanks once again.

 

 

Super User
Super User

Re: Converting digits to time

@danchircop 

I used the following settings in my dropdown to produce the short look.  If this does not work for you please send me a screenshot of your dropdown so I can try to replicate it.

 

Height: 40
Width: 90

 

---

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
danchircop
Level: Powered On

Re: Converting digits to time

@mdevaney 

 

I see ok thanks.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,515)