当前位置:网站首页>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 :
边栏推荐
- Introduction of mongod management database method
- [quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)
- What are the safest securities trading apps
- webgl_ Graphic transformation (rotation, translation, zoom)
- 全日制研究生和非全日制研究生的区别!
- [quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)
- 【数据挖掘】视觉模式挖掘:Hog特征+余弦相似度/k-means聚类
- Use cpolar to build a business website (2)
- ./ Functions of configure, make and make install
- Do you know the relationship between the most important indicators of two strong wind control and the quality of the customer base
猜你喜欢
银行需要搭建智能客服模块的中台能力,驱动全场景智能客服务升级
[quick start of Digital IC Verification] 26. Ahb-sramc of SystemVerilog project practice (6) (basic points of APB protocol)
【数字IC验证快速入门】25、SystemVerilog项目实践之AHB-SRAMC(5)(AHB 重点回顾,要点提炼)
[target detection] yolov5 Runtong voc2007 data set
【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
有钱人买房就是不一样
Keil5 does not support online simulation of STM32 F0 series
[quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)
【數字IC驗證快速入門】20、SystemVerilog學習之基本語法7(覆蓋率驅動...內含實踐練習)
[quick start of Digital IC Verification] 20. Basic grammar of SystemVerilog learning 7 (coverage driven... Including practical exercises)
随机推荐
Oracle control file loss recovery archive mode method
Points for attention in porting gd32 F4 series programs to gd32 F3 series
Detailed explanation of Cocos creator 2.4.0 rendering process
HPDC smart base Talent Development Summit essay
Oracle控制文件丢失恢复归档模式方法
【深度学习】语义分割实验:Unet网络/MSRC2数据集
Getting started with webgl (2)
Annexb and avcc are two methods of data segmentation in decoding
Getting started with webgl (4)
银行需要搭建智能客服模块的中台能力,驱动全场景智能客服务升级
Getting started with webgl (3)
A need to review all the knowledge, H5 form is blocked by the keyboard, event agent, event delegation
VS2005 strange breakpoint is invalid or member variable value cannot be viewed
避坑:Sql中 in 和not in中有null值的情况说明
Matlab experience summary
Spin animation of Cocos performance optimization
Connecting FTP server tutorial
How to create Apple Developer personal account P8 certificate
Asynchronous application of generator function
[original] all management without assessment is nonsense!