cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Use IsMatch to format a time entry

Hello, I need to format a datacard value to only accept the following time format, can I use IsMatch to do this, and if so, how do I go about it?

 

8:00 am - 5:00 pm

 

My users need to enter Hours of Operation for the resources we track. I am having issues making it recognize the colon, or the am/pm function. Also, it will need to be something that accepts a 12 hour clock so "##:## am/pm - ##:## am/pm" seems like it would work, but it doesn't.

 

Please help. I am not the greatest at syntax.

2 REPLIES 2
Super User
Super User

Re: Use IsMatch to format a time entry

Hey @Anonymous

 

 

The time they need to fill in is it a string or is it a date time?

Maybe you could do something like this:

IsMatch("8:00am - 5:00 pm", "\d\:\d{2}\s\p{2}\s\-\s\d\:\d{2}\s\p{2}")

 

Not sure about the colon and the hyphen format but I guess it is something like that.

 

Kind regards

 


Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Anonymous
Not applicable

Re: Use IsMatch to format a time entry

Tom, thanks for responding. I believe it would be considered a string. Essentially the datacards will allow my co-workers and volunteers to enter information about resources, that will then be shared with clients. The data being entered requires the specific formatting for consistency. I can't have one person entering 9-5, while another enters10:30 am to 4:30 pm, and so on. Therefore I need to force their hands a bit and require specific formatting. I am just beginning the switch from Access, where input masks handled this, so I am a little lost. I have to do the same thing for my phone numbers, but this one is a little more complicated.

 

Also, I am not sure where to put this requirement, as replacing the Parent.Default in the Data section of the valuecard simply returned the response false once and then did nothing further.

 

Any help is appreciated as I learn this new program.

 

Priscilla

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,298)