7 Replies Latest reply: Nov 30, 2015 11:38 AM by Stefan Wühl RSS

    Year(Today()) is not giving correct value in Script Editor

    Vishnu Musani

      Hi All,


      I am deriving a date based upon a year value by keeping month as '12' and date as '31' so that my date will appear as YYYY/12/31.

      For current year i need to create date as "CurrentYear/Current Month/lastdayofpreviousmonth"


      Year     Date

      2009     2009/12/31

      2010     2010/12/31

      2015     2015/10/31 (As previous month is October)


      In order to achieve that i am writing below code. but Year(Today()) is always giving '1905-07-07' because of that my formula is not working, Can you please suggest.


      if( (year(Today()) =[Calendar Year]),Date((MonthStart(Today())-1),'YYYY-MM-DD'), date#(date(makedate([Calendar Year],'12','31'),'YYYY-MM-DD'),'YYYY-MM-DD')) as Tran_Date;