3 Replies Latest reply: Mar 17, 2014 11:58 AM by Rory Webber RSS

    Date format changing between variable declaration and usage

    Rory Webber



      I'm using variables within my load script to specify a max and min date range to load data for.


      I am declaring the following in the variables:

      let vFirstDate = date(YearStart(addYears(today(), -2)), 'YYYY-MM-DD');

      let vLastDate = date(today()-1, 'YYYY-MM-DD');


      When running through debug I can see that vFirstDate is set to 2012-01-01 and vLastDate is 2014-03-16


      All good so far.

      The next step of the script is to load some data in from the DB, and use these min/max values against a specific date. The line in my script is:


      BDT.servicedate between $(vFirstDate) and $(vLastDate)


      When the debugger interprets that line however, I get the following SQL:


      BDT.servicedate between 2012-01-01 and 16/03/2014


      This then fails, as the field on the DB is expected YYYY-MM-DD.


      Any ideas?