当前位置:网站首页>Postman generate timestamp, future timestamp
Postman generate timestamp, future timestamp
2022-07-07 15:46:00 【Test super brother】
Support acquisition : Current timestamp 、 Future timestamp 、 Specify time stamp 、 The current date is 、 In the future
- Get the current timestamp
// Get the current timestamp
let timestamp = (new Date()).getTime().toString();
// Console output timestamp
console.log(" Current timestamp :",timestamp)
// hold startDate Set timestamp as environment variable
pm.environment.set("startDate", timestamp);
demonstration :
- Specify Date , Generate timestamps
// Set date timestamp
var data_f = new Date(2022,7.05);
var appoint = data_f .getTime()
console.log(" Specify a date timestamp :",appoint)
pm.environment.set("expiration", appoint);
demonstration :
- Get future timestamp
// Get the current time in the format of year month day
var date = new Date();
// Set the current time to 3 Days later
date.setDate(date.getDate() + 3)
// Check whether the modification is successful
console.log(date)
// Put the revised time , Convert to timestamp
var toTimes = date.getTime()
// Check the timestamps
console.log(toTimes)
// hold toTimes Set to expirationDate environment variable
pm.environment.set("expirationDate", toTimes);
demonstration :
- Get future timestamp And “ Sand carving method ”:
// Future timestamp
let appoint = new Date().getTime();
// Three days total milliseconds =259200000
appoint=appoint+259200000
console.log('72 Time stamp of ', appoint)
pm.environment.set("expirationDate", appoint);
demonstration :
- obtain : Specific date (YYYYMMDDHHmmss)
// Quoting third-party libraries :moment Equate to import moment from 'moment'
var moment = require('moment');
// call moment() Method to get the current time , And format , With variable currentRime receive
var currentTime = moment().format(" YYYYMMDDHHmmss");
// Print the value of the current time to the console
console.log(" The current time is :", currentTime);
// Put it in the environment variable
pm.environment.set("beginTime", currentTime);
demonstration :
- Get future time :10 Minutes later
// Quoting third-party libraries :moment Equate to import moment from 'moment'
var moment = require('moment');
// Future time , such as : At the present time 10 Minutes later , Accurate to seconds
var beginTime = moment().add(10,"m").format(" YYYYMMDDHHmmss");
// Starting time , At the present time 1 Hours later, , Accurate to seconds
var endTime = moment().add(1,"H").format(" YYYYMMDDHHmmss");
console.log("10 Time in seconds :", beginTime);
console.log("1 Hours later :", endTime);
demonstration :
- Date format : 2022-07-04T11:27:15
// 72 Hours later
var moment = require('moment');
var YTD = moment().add(72,"H").format(" YYYY-MM-DDTHH:mm:ss");
console.log("72 Mm / DD / yyyy time after :",YTD);
// Set as variable
pm.environment.set("tokenExpirationTime", YTD);
demonstration :
- Generate current time , The type is :“2022-07-01T05:18:17.580Z”
var a = new Date()
console.log(" current time :",a)
demonstration :
- Three days after generation
var a = new Date()
a.setDate(4)
console.log(" Future time :",a)
demonstration :
边栏推荐
- [markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)
- What are PV and UV? pv、uv
- [make a boat diary] [shapr3d STL format to gcode]
- TypeScript 发布 4.8 beta 版本
- After UE4 is packaged, mesh has no material problem
- Async and await
- VS2005 strange breakpoint is invalid or member variable value cannot be viewed
- 使用cpolar建立一个商业网站(2)
- Write sequence frame animation with shader
- Use of SVN
猜你喜欢
【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)
Getting started with webgl (4)
【OBS】RTMPSockBuf_ Fill, remote host closed connection.
postman生成时间戳,未来时间戳
Write a ten thousand word long article "CAS spin lock" to send Jay's new album to the top of the hot list
[quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)
Cut ffmpeg as needed, and use emscripten to compile and run
【数字IC验证快速入门】25、SystemVerilog项目实践之AHB-SRAMC(5)(AHB 重点回顾,要点提炼)
The difference between full-time graduate students and part-time graduate students!
How to create Apple Developer personal account P8 certificate
随机推荐
Nacos conformance protocol cp/ap/jraft/distro protocol
[quick start of Digital IC Verification] 22. Ahb-sramc of SystemVerilog project practice (2) (Introduction to AMBA bus)
【数字IC验证快速入门】24、SystemVerilog项目实践之AHB-SRAMC(4)(AHB继续深入)
Points for attention in porting gd32 F4 series programs to gd32 F3 series
【Markdown语法高级】让你的博客更精彩(四:设置字体样式以及颜色对照表)
Unity's ASE realizes cartoon flame
Introduction of mongod management database method
【数字IC验证快速入门】25、SystemVerilog项目实践之AHB-SRAMC(5)(AHB 重点回顾,要点提炼)
Configure mongodb database in window environment
Create lib Library in keil and use lib Library
Excerpted words
Basic knowledge sorting of mongodb database
银行需要搭建智能客服模块的中台能力,驱动全场景智能客服务升级
Cocos makes Scrollview to realize the effect of zooming in the middle and zooming out on both sides
Mathematical modeling -- what is mathematical modeling
Write a ten thousand word long article "CAS spin lock" to send Jay's new album to the top of the hot list
全日制研究生和非全日制研究生的区别!
[markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)
How to create Apple Developer personal account P8 certificate
./ Functions of configure, make and make install