1 Reply Latest reply: Nov 22, 2013 2:57 PM by rp0428 RSS

    With JavaDB, how do I padd leading zeros for month(xxx)?

    936354

      [code]

       

      TRIM(CAST(CAST(YEAR( { fn  TIMESTAMPADD(SQL_TSI_MONTH,  -6  ,   CURRENT_DATE) }) AS CHAR(4) ) AS VARCHAR(4)))  || '-' ||   

                 

       

      [/code]

      TRIM(CAST(CAST(MONTH( { fn  TIMESTAMPADD(SQL_TSI_MONTH, -6  ,   CURRENT_DATE) }) AS CHAR(2) ) AS VARCHAR(2)))  

      Used for comparisons, thanks

      Jack