Jump to content

Recommended Posts

  • Newbies
Posted

Hi all.

 

I have a field called Start Time. Typically users enter something like "6pm" which I have the layout object set to display the format as "6:00 PM". The issue is—the data is still stored as "6pm" so when it shows up on layouts in <<Start Time>> it shows as how its stored and not formatted nicely. 

I am trying to replace the "6pm" input with the desired format of "6:00 PM" in the stored field but I am having trouble. I have tried the Auto Enter Calculated Value with GetAsTime ( Start Time ) and it didnt work. I also created a script and script trigger, onObjectExit to Set Field [ Event::Start Time; GetAsTime ( Event::Start Time ) ] but it is not working. I have also tried Set Field [ Event::Start Time; Time ( GetAsTime ( Event::Start Time ) )] but this throws a too few parameters error. 

Any suggestions or help would be greatly appreciated. Thank you.

 

Rich

Posted (edited)

Interesting question. I think you have found a bug in the system.

Fortunately there is an easy way to solve the problem you stated:

1 hour ago, RichGags said:

when it shows up on layouts in <<Start Time>> it shows as how its stored

Merged fields can be formatted the same way as actual field layout objects. Just select the text object containing the merged field and apply the appropriate time data formatting to it (this will of course extend to all time fields merged in the same text object).
 

BTW, if you do want to normalize user entry at its source, you could auto-enter:

Time ( Hour ( Self ) ; Minute ( Self ) ; Seconds ( Self ) )

But if I am not mistaken that will result in AM/PM times being converted to 24-hour format, which may not suit you.

 

Added:

10 minutes ago, comment said:

that will result in AM/PM times being converted to 24-hour format

But this could work:

Let ( 
h = Hour ( Self )
;
Time ( Mod ( h - 1 ; 12 ) + 1 ; Minute ( Self ) ; Seconds ( Self ) ) 
& 
If ( h > 11 ; "PM" ; "AM" )
)

 

Edited by comment

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.