2 Replies Latest reply: Jan 7, 2014 3:07 PM by Shelley Smith RSS

    How to Get Month Number in Script

    Shelley Smith


      Team,

       

      I'm loading an Excel file in the script, and have figured out how to add a Month field calculated from the date, but it shows month name and my other data is month number.  Is there a way to get the month number calculated from the date?  I'm thinking it's probably easy, but I can't find the exact syntax.

       

      Load ABC as [ABC Dashes],
          
      SHPD_QTY,
          
      Date(SHPD_DT, 'M/D/YY') as [Ship Date],
          
      YEAR(Date(SHPD_DT,'M/D/YY')) as [Ship Yr],
          
      MONTH(Date(SHPD_DT,'M/D/YY')) as [Ship Mo],
           1001
      as Site,
          
      COUNTRY_CD,
          
      TAC1_CITY,
           TAC1_STATE,
           TAC1_ZIP5 as [Zip Code]
      FROM
      [H:\QlikView\ABC\ABC_Shipments_2013.xlsx]
      (
      ooxml, embedded labels, table is [ABC Shipments 2013];

       

      Results in Jan, Feb, Mar, etc., but I am looking for 1,2,3,4,5,6,7,8,9,10,11,12..

       

      Thanks,
      Shelley