PHP: Working with Dates

If you need to calculate days, you can perform that using the EVAL action.

See How to evaluate a PHP commands to manipulate variables and clipboard (Experimental feature) for details on EVAL action.

PHP syntax


date(format, date);

Code samples:

date('d.m.Y',strtotime("- 10 Days"))
date('d.m.Y',strtotime("+ 3 weeks"))
date('d.m.Y',strtotime("- 2 Months"))
date('d.m.Y',strtotime("next Saturday"))
date('d.m.Y',strtotime("last Year"))


1) Set a value to variable “days_before” in Editor->Data :
“days_before” = 10

2) Use EVAL in a test step with this constant:

EVAL "".date('d.m.Y', strtotime("-".${"days_before"}." Days") )

Running this EVAL action on today’s date 23.04.2022 results in a clipboard value 13.04.2022

Free Webinar

Uncover the secrets of automated testing in the free webinar.