Jump to content
Server Maintenance This Week. ×

"loose" time entry field?


This topic is 706 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey all!

I'm trying to get some Start Time / End Time fields working super smoothly for myself and other users.

The fields are actual Time fields.

I want people to be able to enter anything that resembles a 24 hour time and have it be recognised and then displayed as 24hr in this format:    HH:MM

So I should be able to enter 0730 and it will be recognised as 07:30AM and shown in 24hr format as this:  07:30

Or 1430 is recognised as 2:30pm and displayed as 14:30

Or indeed if someone wanted to enter it with the colon that would be recognised too (although this is less important) - so if I entered 11:30 it would be understood as 11:30AM and displayed in 24 hour format as 11:30

 

I've tried some triggered scripts suggested here - but they don't seem to work for me in the way I want.  

If I enter 1130 - it gets turned into 1130:00. 

Link to comment
Share on other sites

Try defining the field to auto-enter calculated value (replacing existing value) =

Let (
n = GetAsNumber ( GetAsText ( Self ) ) 
;
Time ( Div ( n ; 100 ) ; Mod ( n ; 100 ) ; 0 ) 
)

This allows you to enter the times as HHMM or HMM (without leading zero for hours) or MM or M.

However, this assumes you will not be entering seconds - including when editing the field. A more elaborate formula would be required to recognize such entry and make an exception.

Note also that there is no validation: an entry of 1590 will be interpreted as 15 hours and 90 minutes, resulting in time 16:30:00 .

 

Edited by comment
Link to comment
Share on other sites

That’s awesome! Thanks so much :) 

The people in this forum are so good!

I don’t think we will ever be entering seconds, so that’s not a problem. 
 

thanks again. 

Link to comment
Share on other sites

This topic is 706 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.