Multiple format time entry

Community Beginner ,
Jun 28, 2019

Copy link to clipboard

Copied

I want to allow users to enter the time in whatever form they want (as long as it's at least 3 digits {e.g. 0800, 800, 8:00, 0925}) and have the time displayed using the h:MM format when they finish.  I've not been able to find an example of an OR statement that will allow something like this.  Any help is appreciated.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

121

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Multiple format time entry

Community Beginner ,
Jun 28, 2019

Copy link to clipboard

Copied

I want to allow users to enter the time in whatever form they want (as long as it's at least 3 digits {e.g. 0800, 800, 8:00, 0925}) and have the time displayed using the h:MM format when they finish.  I've not been able to find an example of an OR statement that will allow something like this.  Any help is appreciated.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

122

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 28, 2019 0
Most Valuable Participant ,
Jun 28, 2019

Copy link to clipboard

Copied

You will need to write a script that looks at the length of the input string. If it's 3 characters, add a colon after the first one. If it's 4, add it after the second.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2019 0
Community Beginner ,
Jun 28, 2019

Copy link to clipboard

Copied

Thank you for your reply.  However, that doesn't answer the conversion of 24 hour to 12 hour.  Do you happen to have a sample script or something to work with?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2019 0
try67 LATEST
Most Valuable Participant ,
Jun 28, 2019

Copy link to clipboard

Copied

I don't understand what you mean by that... Do you mean that if someone enters "2000" it should change it to "08:00"? How would you know if it's 8 AM or PM?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2019 0