I know I am able to add current timestamp into Request like this:
postman.setEnvironmentVariable('pickUpTime',(new Date()).toISOString());
However, I want to add 10min later to the current timestamp of Postman. How can I do that?
Seems I am not able to do it like this:
postman.setEnvironmentVariable('pickUpTime',(new Date() + 10000).toISOString());
You can use the add
function of moment.js within Postman, it makes this type of thing so simple and easy to manage.
var moment = require("moment")
pm.environment.set('pickUpTime', moment().add(10, 'minutes').toISOString())
This will set this value to an environment variable, using the the newer syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With