Documentation

Looking for something in particular?

DateAdd

This function adds a defined number of days to a given date to create a later date value. This is useful for avoiding hardcoded values for a date in a test step, e.g., a test failing because a Close Date was in the past.

Format: DateAdd(date,amount,unit)

There are two internal functions which are useful when managing dates:

  • TODAY will create a date using the GMT time zone.
  • NOW will create a date timestamp using the GMT zone.

Examples:

{TODAY}– This will create a date using the GMT zone, e.g., 2015-01-16

{NOW}– This will create a date timestamp using the GMT zone, e.g., 2015-01-16 10:13:43.0

{DateAdd(TODAY,1)}– This will default to tomorrow, e.g., 2015-01-17

{DateAdd(TODAY,"-1")}– This will default to yesterday, e.g., 2015-01-15

{DateAdd(TODAY,1,MONTH)}– This will add one month to the current date, e.g. 2015-02-16

{DateAdd(NOW,"-2",HOUR)}– This will remove two hours from the current date and time, e.g. 2015-01-16 08:15:27.0

Note: If you are using a negative number, the value should be enclosed in double quotes, e.g. {DateAdd(TODAY,“-1”)}.

Practice


Want to learn more about using this function in Automation? You can use the following sample test case to get started. Simply right-click to download DateAdd.testcase and then drag and drop the test case into the test folder within the Navigator panel of Automation.

Note: Unzip/extract the compressed file before using it in Automation.

Review Provar on G2
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top