5 Replies Latest reply on May 13, 2015 3:19 PM by philmodjunk

    Formatting Time

    JohnMaher

      Title

      Formatting Time

      Post

      I am trying to format a time input. With my current script below the input is "11:00 am" and the result is "11:00:00 AM"

      GetAsText(MyTime - Time(If(Hour(MyTime) > 12; 12;0); 0;0)) & If (Hour(MyTime) > 11; " pm." ; " am.")

      My question is how can I change the calculation to omit the seconds from the output?

        • 1. Re: Formatting Time
          philmodjunk

          Why do you need any calculation at all? Data formatting can format the MyTime field to use 12 hour format and to not display seconds.

          • 2. Re: Formatting Time
            JohnMaher

            I know it seems strange but I am using this calculation to make sure that the AM or PM that is printed in a layout is always consistent no matter how the employee inputs it during data entry.

            • 3. Re: Formatting Time
              philmodjunk

              And that can be handled by specifying a data format for that time field instead of using a calculation field. The format used to enter the time--as long as it's valid, won't effect the format specified by the data formatting specified for the field when it comes time to print or browse this data.

              • 4. Re: Formatting Time
                JohnMaher

                 

                 

                I must be doing something wrong then. I already have the data format specified so that if an employee input this

                the result in the data entry interface would be

                BUT when you try to print that information in a layout it seems to use the original input format instead of the formatted version as seen below.

                • 5. Re: Formatting Time
                  philmodjunk

                  You need to specify the data format on the layout from which you print the info. This is possible even if you are using merge fields as you can select the entire block of text that includes the merge field (handles should be showing, not highlighted text) and then use the data formatting options to specify the desired format.