How to select any time format of a week to a specific format?

Currently, I am working on a process that takes the user’s input (Which would be time and day of a week) and put them in a specific format. I am putting some examples that I want them in (“hh:mm tt”) format with the day of the week.

  1. mon-fri 10:30am-8:30pm
  2. monday to friday 10:30 am to 8:30 pm
  3. m-f 10:30am-8:30pm
  4. mon: 8-10
    tue: 8-10
    wed: 8-10
    thu: 8-10
    fri: 8-10
  5. mon/wed 1000-2230
  6. sundays 07:00-14:00
  7. mon-fri 8-10
    closed on weekends
  8. mon,tue,wed,thu,fri: 8:30am-4
  9. 24x7
  10. Never Closed

Problem is that the user doesn’t provide in any specific format and if you notice sometimes it happens that one or more data miss(for example, AM or PM or space) ruining the whole format.

I’m aiming for something that takes any of the cases (say “m-f 10:30 am-8:30pm”) and gives the output in a systemic way like,
Monday 10:30 AM 08:30 PM
Tuesday 10:30 AM 08:30 PM
Wednesday 10:30 AM 08:30 PM
Thursday 10:30 AM 08:30 PM
Friday 10:30 AM 08:30 PM

Your input data is free text (it think) which means you are always going to have data integrity issues.

You could run some regex over it looking for the most common inputs but it’s never going to be perfect.

Educate your users. Try putting some examples on the form so users know what to put in the field. This should increase the rates of suitable formats.

Hi @Steven_McKeering,
Thanks for your reply I figured this part out, was thinking if there was any other way.