如何在邮递员的当前时间戳中增加更多时间? [英] How to add more time into current timestamp of Postman?
问题描述
我知道我可以像这样将当前时间戳添加到请求中:
I know I am able to add current timestamp into Request like this:
postman.setEnvironmentVariable('pickUpTime',(new Date( ))。toISOString());
但是,我想在Postman的当前时间戳中添加10分钟。我该怎么办?
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());
推荐答案
您可以使用add 函数邮递员中的= nofollow noreferrer> moment.js ,它使这种事情变得如此简单和易于管理。
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.
这篇关于如何在邮递员的当前时间戳中增加更多时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!