Provar

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 of a Close Date being 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 time zone.

Examples:

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

{NOW}– This will create a date timestamp using the GMT time 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 datetime, 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 Provar? 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 Provar.

Note: You will need to unzip/extract the compressed file before using it in Provar.

Review Provar on G2
Documentation library

Other available resources

Looking for something different?

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