2 Replies Latest reply: Jan 25, 2017 11:08 AM by m w RSS

    Inaccurate date load

      Hello all,


      I am trying to load in some data from a database, but only up to and including the previous day (yesterday). The current line in the script to get yesterday's date is:


      Set PullDate = Today(Now(1))-1;


      This app runs automatically every day at 6:15 AM in QMC and stores the data into a QVD, but each day it does not pull in the correct date for yesterday, but instead pulls in the date for two days ago. So something is not updating correctly here.


      When I manually run the QMC job again about 15 minutes later, the data in the QVD is accurate, and the PullDate is indeed equal to yesterday's date.


      Any ideas on why this is happening?


      Thank you.

        • Re: Inaccurate date load
          Vishwarath Nagaraju

          Try using LET


          LET vPullDate = Today(Now(1))-1;


          LET vPullDate = Date(Today(Now(1))-1);

          • Re: Inaccurate date load
            m w

            You are tring to use a timestamp as the argument for the today() function.

            This is from Help:


            today([timer_mode] )

            Returns the current date from the system clock. The timer_mode may have the following values:

            0 Date at script run
            1 Date at function call
            2 Date when the document was opened  

            Default timer_mode is 2. The timer_mode = 1 should be used with caution, since it polls the operating system every second and hence could slow down the system.