ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Iso date to Hundred year format

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

  • Iso date to Hundred year format

    Hi,
    Can anyone please tell me how to convert ISO date (YYYY-MM-DD) to hundred year format?I want to use a built in function for this.


    Thanks,
    Sateeshs

  • #2
    Re: Iso date to Hundred year format

    You do not need a bif for this.

    Just do a move (non-free)
    or
    /free
    datedmy = dateiso;
    /end-free
    Regards

    Kit
    http://www.ecofitonline.com
    DeskfIT - ChangefIT - XrefIT
    ___________________________________
    There are only 3 kinds of people -
    Those that can count and those that can't.

    Comment


    • #3
      Re: Iso date to Hundred year format

      btw... if it was an alhpa field you wished to convert, then use the %date BIF
      Regards

      Kit
      http://www.ecofitonline.com
      DeskfIT - ChangefIT - XrefIT
      ___________________________________
      There are only 3 kinds of people -
      Those that can count and those that can't.

      Comment


      • #4
        Re: Iso date to Hundred year format

        By Hundred year format I meant number of days from year 1900.

        Comment


        • #5
          Re: Iso date to Hundred year format

          number of days from 1900 = ((current year - 1900) * 365) + no. of leap year between this duration.

          I think u just wan't to count number of days....
          great programmer never dies....

          patino

          Comment


          • #6
            Re: Iso date to Hundred year format

            I will give an example

            Today's date 03/11/08 in the hundred year format is 39517. May be it is called by a different format by you all. I just want to know how to convert ISO date to "hundred year" format or by whatever name you call it.


            Thanks,
            sateeshs

            Comment


            • #7
              Re: Iso date to Hundred year format

              %DIFF is the BIF you want

              Code:
              D NumberDays      S              6  0                   
              D StartDate       S               D   DatFmt(*ISO)      
              D EndDate         S               D   DatFmt(*ISO)      
                                                                      
               /free                                                  
                 StartDate = %DATE('1900-01-01');                     
                 EndDate = %DATE();                                   
                 NumberDays = %DIFF(EndDate:StartDate:*DAYS);         
                 DSPLY NumberDays;                                    
                 RETURN;                                              
               /end-free
              Goodbye

              Comment


              • #8
                Re: Iso date to Hundred year format

                Thank you...It works

                Comment


                • #9
                  Re: Iso date to Hundred year format

                  Just as a caveat -- the reference date should be 1899-12-31. Otherwise, the %DIFF function will be "off by one."
                  http://www.linkedin.com/in/chippermiller

                  Comment

                  Working...
                  X