Inputting military time without using the colon (:)

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

Is there a way to input military time in the time field without having to use colons (:)? As of now I have to write 16:00 to get 4:00 PM in the time field but I would like to input it like this:  1600 and output should be 4:00 PM it would save a lot of time when inputting thank you.

Photo of Andres

Andres

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
You can make an input field as a pure numeric data entry field and then make a new formula time-of-day field to be the field you use in forms and reports.

not tested but you could try

var text DataEntry = totext([my new data entry field]);

ToTimeOfDay(NotRight($DataEntry, 2) & ":" & Right($DataEntry, 2))
Photo of Andres

Andres

  • 0 Points
Thank you it worked perfectly
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
Great,

If you have existing data using the old method you will need to have a formula field to use that old field if it was populated else the new field.

I also have a formula which allows users to enter just the time of day, such as 200 for 2:00 pm.  In an app I wrote for a client they are only open during normal business hours, so I can infer the AM  PM based on the value entered, ie 200 must be 2:00 PM and 1000 must be 10:00 AM.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,894 Points 20k badge 2x thumb
Type or paste in something like this and blur the field:

Attack at 0600 and be back to barracks by 1600!

Military Time Shortcode - Add New Record
https://haversineconsulting.quickbase.com/db/bj4yismsy?a=nwr

The script will recognize four consecutive digits as a military time and convert it to civilian format. This is just a demo created in a few minutes so if you enter 9999 you will get 87:99 PM - duh?

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=421
Photo of Leo

Leo

  • 0 Points
this is great, do you have a way to include seconds? for example: 021159