ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

TimFmt(*USA) - suppress leading zero?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TimFmt(*USA) - suppress leading zero?

    Hi,

    I have a time field defined in my display file with timfmt(*usa). When the value is 3:45pm, it shows "03:45 PM".

    How can I suppress that leading zero (while keeping data type T, i.e. without converting to a numeric or character)? Some of the IBM manual searches that I've looked at for timfmt(*usa) seem to indicate that for *usa the leading zero can be suppressed, but it doesn't show how (or at least I haven't found it).

    Any ideas?

    Thanks.

  • #2
    Re: TimFmt(*USA) - suppress leading zero?

    You might be able to do this with the CEEDATM api. looking at the documentation for it it looks like you can provide a mask to display just the time zero suppressed.

    Comment


    • #3
      Re: TimFmt(*USA) - suppress leading zero?

      Can you point to where it says the leading zero can be suppressed?

      Comment


      • #4
        Re: TimFmt(*USA) - suppress leading zero?

        Originally posted by Barbara Morris View Post
        Can you point to where it says the leading zero can be suppressed?
        If you look at the examples given in the entry for the API in Information Center, one example using this picture string: WWW, MMM DD, YYYY ZH:MI AP results in MON, MAY 16, 1988 7:01 PM, which has the time zero suppressed. Later examples show displaying just the year or hour based upon the picture string you use. So you could probable use picture string: "ZH:MI AP" to show a zero suppressed *USA time.

        Comment


        • #5
          Re: TimFmt(*USA) - suppress leading zero?

          DAG0000, there's no way to use the CEEDATM API without converting the field to character. (Note Viking explicitly says that he does not wish to convert to character.)

          I think Barbara is asking Viking where he saw that a 'time' field can be displayed without the leading zero. (I've never heard of this, either.)

          Comment


          • #6
            Re: TimFmt(*USA) - suppress leading zero?

            Can you point to where it says the leading zero can be suppressed?
            Hmmm... maybe not. I just tried to try to see if I could find what I was remembering regarding this. However, I see now that this relates to string representations of the time in *usa format, e.g. the example showing '1:30 PM'.

            http://pic.dhe.ibm.com/infocenter/is...imestrings.htm

            So no, it doesn't look like I have seen anywhere that says it can be done (sorry), and if Scott and Barbara don't think that capability exists, then I'm pretty sure it doesn't!

            edit: Although here's a link I remember looking at previously that gave me hope: In the table it shows 2:00 PM without the leading zero. But in the example at the bottom it does show the leading zero.
            http://pic.dhe.ibm.com/infocenter/is...imestrings.htm

            So it looks like it's not possible to show a time-type field in *usa format without the leading zero (without converting to something else). No big deal, but I (and our users) just think 1:30 PM looks better than 01:30 PM.

            Thanks for the replies. Btw, DAG0000, those picture strings are pretty cool and I use them quite a bit in an old service program with CEEDATE and they work great. Thanks.
            Last edited by Viking; November 11, 2013, 06:22 PM.

            Comment

            Working...
            X