ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Julan to MMDDCCYY format

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

  • Julan to MMDDCCYY format

    I have a date field 2008128 and I need to convert it into the MMDDCCYY format.

    The %date conversion doesn't seem to work. Any suggestions.

    DAC

  • #2
    Re: Julan to MMDDCCYY format

    Clarification question: Is 2008128 a numeric field or *longjul? (Longjul would be 2008/128)
    http://www.linkedin.com/in/chippermiller

    Comment


    • #3
      Re: Julan to MMDDCCYY format

      No, its a text field.

      DAC

      Comment


      • #4
        Re: Julan to MMDDCCYY format

        Hi,

        assumed that both dates are numeric, try the following:

        Code:
         /Free
            DateNum8 = %Dec(%Date(MyJulDate: *LongJul): *USA);
         /End-Free
        If the dates are character, you have to add a *Zero immediately after the format:
        Code:
         /Free
            DateNum8 = %Dec(%Date(MyJulDate: *LongJul0): *USA0);
         /End-Free

        Birgitta

        Comment


        • #5
          Re: Julan to MMDDCCYY format

          To clarify just a bit...

          If the field containing the date value is a text field, RPG is expecting there to be a separator character in the value, like 01/17/2008. If your value doesn't contain the separator character, you need to tell the %date BIF that by sticking a zero (0) on the end of the format identifier (*usa0, for instance).

          In your case, that would be, as Birgitta wrote, *LongJul0.
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment


          • #6
            Re: Julan to MMDDCCYY format

            CHRGOFFDTE = '2008126'

            So I took the recommendation and wrote this statement:

            ACTDATE = %char(%Date(CHRGOFFDTE: *LongJul0): *USA0);


            Thanks,

            DAC

            Comment

            Working...
            X