Krishna Murthy
Krishna Murthy

Reputation: 97

How to get yesterday date in jmeter

I want yesterday date in my script, how to get it in JMeter scripts.

Ex ${__time(yyyy-MM-dd)}

I am using current time How to get decrease the date with previous date I tried with

 ${__time(yyyy-MM-dd)} - 1

But not worked

Upvotes: 1

Views: 3797

Answers (1)

Ori Marko
Ori Marko

Reputation: 58862

You can use __timeShift function to get yesterday:

${__timeShift(yyyy-MM-dd,now,-P1D,yesterday)}

The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added

This will also save value in JMeter variable yesterday accessible later using `${yesterday}

Upvotes: 3

Related Questions